note 52796 deleted from control-structures.foreach by felipe
| From: | felipe@php.net | Date: | Sun, 09 Dec 2007 16:04:30 +0000 |
| Subject: | note 52796 deleted from control-structures.foreach by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133046@lists.php.net to get a copy of this message | ||
Note Submitter: Michael T. McGrew
----
This can be used to creat a list of urls for a nav bar or links section etc. If you draw the values
of array from a mysql database it can be very usefull.
<?php
$arr = array(news, events);
foreach ($arr as $value) {
echo "<tr><td>Manage <a
href=\"./".$value.".php\">".$value."</a></td></tr>";
}
?>
will return
<tr>
<td>Manage <a href="./news.php">news</a>
</td>
</tr>
<tr><td>Manage <a href="./events.php">events</a>
</td>
</tr>