note 28287 added to ref.array
| From: | philNOSPAMippe at moNO-SPAMrange dot n-e-t | Date: | Wed, 08 Jan 2003 14:35:22 +0000 |
| Subject: | note 28287 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41826@lists.php.net to get a copy of this message | ||
Hi,
I took the function from spam (at) speedcapture . com
I simplified it just a little, and here is the result.
Thanks for sharing this great tool with us. Simple, but sooooo usefull :)
function view_array($arr, $td=0)
{
if ($td) {
echo '<td>';
}
echo '<table>';
foreach ($arr as $key => $elem) {
echo '<tr>';
echo '<td>'.$key.' </td>';
if (is_array($elem)) {
view_array($elem, 1);
}
else {
echo '<td>'.htmlspecialchars($elem).' </td>';
}
echo '</tr>';
}
echo '</table>';
if ($td) {
echo '</td>';
}
}
You call it as you used to:
Let $myArray be an array of any kind,
simply do view_array($myArray);
--
http://www.php.net/manual/en/ref.array.php
http://master.php.net/manage/user-notes.php?action=edit+28287
http://master.php.net/manage/user-notes.php?action=delete+28287
http://master.php.net/manage/user-notes.php?action=reject+28287