note 49998 deleted from ref.array by nlopess
| From: | nlopess@php.net | Date: | Wed, 16 Feb 2005 20:09:29 +0000 |
| Subject: | note 49998 deleted from ref.array by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85138@lists.php.net to get a copy of this message | ||
Note Submitter: max at caconsultant dot com
----
The following recusive function can dump the contents of an array. I wrote it to help debug HTML
form. Enjoy!
function dump_array($array, $name) {
foreach ($array as $key => $value) {
if (is_integer($key)) $keyName = $key; else $keyName = "'$key'";
if (is_array($value)) {
$newName = $name . "[$keyName]";
dump_array($value, $newName);
} else {
print "{$name}[$keyName] => $value";
print "<br />";
}
}
}
Usage Example:
dump_array($_POST, '$_POST');
Please note that do NOT use " to quote the $_POST.