note 14172 added to function.var-dump.php
| From: | CaseyN0SPAM at CaseyN0SPAMFenton dot com | Date: | Thu, 19 Jul 2001 18:18:31 +0000 |
| Subject: | note 14172 added to function.var-dump.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15596@lists.php.net to get a copy of this message | ||
Here's a recursive function to dump any variable (array, string, object) to the screen using
<UL> tags.
function show_array_tree($a) {
if(!is_array($a) && !is_object($a)) {
echo $a;
return;
}
echo "<ul>\n";
while(list($key, $val) = @each($a)) {
if(is_array($val) || is_object($val)) {
echo "$key\n";
show_array_tree($val);
}
else echo "<LI>$key = '$val'\n";
}
echo "</ul>\n";
}
http://www.php.net/manual/en/function.var-dump.php