<?php
if(!function_exists('echo_r'))
{
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Prints an array Hugo's style
#
# version: 20 October 2006
#
function echo_r($array,$name='')
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
if(!is_array($array))
{
?>error, first parameter: =}<?=$array?>{= is not an array... (<i>echo_r</i>)<br /><?php
return;
}
$temp=count($array);
$temp1=strlen($temp);
?><br />--------------------------------------<br />Array(<?=$name?>)<br />--------------------------------------<br /><?php
$i=0;
if($array)
{
foreach($array as $key=>$value)
{
echo('{'.str_pad($i,$temp1,'0',STR_PAD_LEFT).'}: ['.$key.'] => '.$value."<br />\n");
if(is_array($value))
{
echo_r($value,'$value['.$i.']');
}
$i++;
}
}
?>*EOD*<br /><?php
}
}
?>