note 38723 added to function.array
| From: | god at beetjevreemd dot nl | Date: | Sun, 04 Jan 2004 23:36:18 +0000 |
| Subject: | note 38723 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62911@lists.php.net to get a copy of this message | ||
Heh, I was kinda drunk, and this array I am working on went to live its own life. It didn't
like me or so, it just wouldn't do what I told it to do...
So I created this super fuction what puts the array in a nice table, and guess what.. Its
multy-dimention array compatible!
Ghe, so here is the code:
<?php
function dump_array($array) {
echo "<table
border=\"1\"><tr><td>Key</td><td>Value</td></tr>";
foreach($array as $key => $val){
echo "<tr><td>" . $key . "</td><td>";
if (is_array($val)) {
dump_array($val);
} else {
echo $val;
}
echo "</td></tr>";
}
echo "</table>";
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38723
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38723&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38723&report=yes
Search -- http://master.php.net/manage/user-notes.php