There is one function running around the Internet which someone very smart wrote. I do not know who wrote it, but he was a genius. This function is awesome.
Use the following function to display the content of any multidimensional array:
function LIST_CONTENTS($arrayname,$tab=" ",$indent=0)
{ // recursively displays contents of the array and sub-arrays:
// Free for unrestricted use, except sale - do not resell.
// use: echo LIST_CONTENTS(array $arrayname, string $tab, int $indent);
// $tab = string to use as a tab, $indent = number of tabs to indent result
while(list($key, $value) = each($arrayname))
{
for($i=0; $i<$indent; $i++) $currenttab .= $tab;
if (is_array($value))
{
$retval .= "$currenttab$key : Array: <BR>$currenttab{<BR>";
$retval .= LIST_CONTENTS($value,$tab,$indent+1)."$currenttab}<BR>";
}
else $retval .= "$currenttab$key => $value<BR>";
$currenttab = NULL;
}
return $retval;
}
This function is very useful when displaying for example the content of your $GLOBALS which can have many dimensions.
Use it like
echo LIST_CONTENTS($whateverarrayname);
Enjoy!