Ever use PHP’s var_dump() or print_r() to debug what is going wrong with that $data you have ?
Well, this simple script acts as the above functions, yours first parameter is your data, and the second optional parameter is stoping the script or continuing on.
The ‘debug_backtrace()’ function will return which file call’s the dump function so you can easily track where your errors are coming from.
function dump($data = array(), $finish = TRUE) {
list($referrer) = debug_backtrace();
$total = count($data);
echo '
";
if($finish == TRUE) die;
}