note 14801 added to function.is-array.php
| From: | dalini at dalini dot de | Date: | Wed, 15 Aug 2001 12:51:56 +0000 |
| Subject: | note 14801 added to function.is-array.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16749@lists.php.net to get a copy of this message | ||
Little Array Debug Function will also parse MultiLevelArrays and build a structure
# returns 0 if no array is given
# call: print_array($array,0)
function print_array($array,$level){
if (!is_array($array))
return 0;
reset($array);
while ( list($key, $value) = each($array) ) {
for ($i = 0; $i < $level; ++$i){
echo " ";
}
echo "key: ".$key." val: ".$value."<br>";
if (is_array($value))
print_array($value,$level+1);
}
}
http://www.php.net/manual/en/function.is-array.php