$val) if ($val === $new) $vname = $key;
$var = $old;
echo "
";
if ($info != FALSE) echo "$info:
";
do_dump($var, '$'.$vname);
echo "
";
}
function do_dump(&$var, $var_name = NULL, $indent = NULL, $reference = NULL)
{
$do_dump_indent = "| ";
$reference = $reference.$var_name;
$keyvar = 'the_do_dump_recursion_protection_scheme'; $keyname = 'referenced_object_name';
if (is_array($var) && isset($var[$keyvar]))
{
$real_var = &$var[$keyvar];
$real_name = &$var[$keyname];
$type = ucfirst(gettype($real_var));
echo "$indent$var_name $type = &$real_name
";
}
else
{
$var = array($keyvar => $var, $keyname => $reference);
$avar = &$var[$keyvar];
$type = ucfirst(gettype($avar));
if ($type == "String") $type_color = "";
elseif ($type == "Integer") $type_color = "";
elseif ($type == "Double"){ $type_color = ""; $type = "Float"; }
elseif ($type == "Boolean") $type_color = "";
elseif ($type == "NULL") $type_color = "";
if (is_array($avar))
{
$count = count($avar);
echo "$indent" . ($var_name ? "$var_name => ":"") . "$type ($count)
$indent(
";
$keys = array_keys($avar);
foreach($keys as $name)
{
$value = &$avar[$name];
do_dump($value, "['$name']", $indent.$do_dump_indent, $reference);
}
echo "$indent)
";
}
elseif (is_object($avar))
{
echo "$indent$var_name $type
$indent(
";
foreach($avar as $name=>$value) do_dump($value, "$name", $indent.$do_dump_indent, $reference);
echo "$indent)
";
}
elseif (is_int($avar)) echo "$indent$var_name = $type(".strlen($avar).") $type_color$avar
";
elseif (is_string($avar)) echo "$indent$var_name = $type(".strlen($avar).") $type_color\"$avar\"
";
elseif (is_float($avar)) echo "$indent$var_name = $type(".strlen($avar).") $type_color$avar
";
elseif (is_bool($avar)) echo "$indent$var_name = $type(".strlen($avar).") $type_color".($avar == 1 ? "TRUE":"FALSE")."
";
elseif (is_null($avar)) echo "$indent$var_name = $type(".strlen($avar).") {$type_color}NULL
";
else echo "$indent$var_name = $type(".strlen($avar).") $avar
";
$var = $var[$keyvar];
}
}