I have a little function built up that I use for reviewing arrays :
function disp($a,$t=null) {
static $x = 0;
$i = '_'.$x;
$x++;
$o = null;
$t = "[".$t."]"." => ";
if(is_array($a)) {
$c = ' hidden';
$t .= "ARRAY ";
$o .= "(\n";
foreach($a as $k=>$v) { $o .= disp($v,$k); }
$o .= tag('br').")";
}
else { $o .= $a;$c = ' shown'; }
return tag('span',array('class'=>'k','onclick'=>"showItem('".$i."');"),$t).tag('span',array('id'=>$i,'class'=>'v'.$c),$o)."\n";
}
function ts($a,$t=null) {
global $ts;
$x = tag('pre',null,disp($a,$t));
$ts .= $x;
return $x;
}
calling the ts(ARRAY,COMMENT) function at any time (with appropriate entries) adds the output to the generic $ts string. I can also echo each instance of ts() if necessary.
(the tag() function simply creates HTML tags: tag(TAGNAME,ATTRIBUTES,CONTENT).
Then I can echo the $ts variable at the end of my HTML output (prior to </body>).
The css & HTML necessary are:
a.trouble,
a.trouble:link,
a.trouble:visited { clear:both; float:left; color:#f00; }
pre { clear:both; float:left;font-size:1.2em; font-family:Comic Sans MS,sans-serif; color:#fff;background:#000;}
div#troubleshooting.shown { display:block; }
div#troubleshooting.hidden { display:none; }
div#troubleshooting span.k { clear:both; float:left; padding-left:10px;}
div#troubleshooting span.v { clear:none; float:left; padding-left:0px;}
div#troubleshooting span.shown { display:block; }
div#troubleshooting span.hidden { display:none; }
$trouble .= tag('a',array('href'=>'javascript:void(null);,'onclick'=>"showItem('troubleshooting');",'class'=>'trouble'),'DEV');
$trouble .= tag('div',array('id'=>'troubleshooting','class'=>'hidden'),$ts);
echo $trouble