note 12774 deleted from ref.array by jeroen

From: Date: Wed, 29 Aug 2001 17:55:08 +0000
Subject: note 12774 deleted from ref.array by jeroen
Groups: php.notes 
Request: Send a blank email to php-notes+get-17343@lists.php.net to get a copy of this message
I have decided to rename my function to array_tree(), because it doesn't realy print the array. I also wrote a new parray() and have added a few lines to array_tree(): 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; } array_tree() now returns the treeview as a string, and parray_tree() print this string as preformated (<pre> should use a fixed-font). Have fun :)

« previous php.notes (#17343) next »