I found this from a user on the support docs at www.php.net. It has been very useful when debugging arrays.
function ListArray($var, $title='ListArray')
{
if($title){ $string = ''; }
$string .= '<table border="0" cellpadding="2" cellspacing="1" bgcolor="CCCCCC" style="font-size: 10px;">';
if($title){ $string .= '<tr bgcolor="003346" style="color: whitesmoke;"><td><b>Key</b></td><td><b>Value</b></td></tr>'; }
while(list($key, $val) = each($var))
{
$string .= '<tr bgcolor="whitesmoke">' ;
$string .= "<td valign=\"top\"><b>$key</b></td><td valign=\"top\">";
if(is_array($val)){
$string .= ListArray($val, '');
}else{ $string .= "$val" ; }
$string .= '</td></tr>';
}//While
$string .= "</table>";
if($title){ $string .= ''; }
return $string;
}
$TheArray[1] = 'foo';
$TheArray['bob']] = 'is cool';
ListArray($TheArray);
Hope it helps.