knightcon
New Member
- Messages
- 69
- Reaction score
- 0
- Points
- 0
Hey there, this is a very simple tutorial mainly for beginner PHP coders. This is the first of what I hope will become a very long series of tutorials.
Difficulty: Easy
Coding Time: 10 Minutes
Extensions: None
Overview
This tutorial loops through an array of hyperlinks and outputs them in an unordered list.
hyperlink.php
This code will produce something like the following...
Difficulty: Easy
Coding Time: 10 Minutes
Extensions: None
Overview
This tutorial loops through an array of hyperlinks and outputs them in an unordered list.
hyperlink.php
PHP:
<?php
$array['Link One Caption'] = "page.html";
$array['Link Two Caption'] = "page2.html";
$array['Link Three Caption'] = "page3.html";
echo("<ul>");
foreach($array as $caption=>$link) {
echo("<li><a href='$link'>$caption</a></li>");
};
echo("</ul>");
This code will produce something like the following...
Last edited: