Below is a function I found in the manual or somewhere on  I tried
to find it to provide a link so the author would get some credit.  Sorry but
no luck.  Anyway, this is a handy little function when you are trying to
figure out the contents of an array.


function array_tree($array , $prep='') {
if(!is_array($array)) {
print '<b>array_tree:</b> This is not an array';
return false;
$prep .= '|';
while(list($key, $val) = each($array)) {
$type = gettype($val);
if(is_array($val)) {
$line = "-+ $key ($type)\n";
$line .= array_tree($val, "$prep ");
} else {
$line = "-> $key = \"$val\" ($type)\n";
$ret .= $prep.$line;
return $ret;

function parray_tree($array) {
print '<pre>';
print array_tree($array);
print '</pre>';
return true;

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to