It’s not pretty and it’s not elegant, but we’ve all got a bag of quick and dirty functions that help make life just a little bit easier.
This is a simple print_r()
but I finally got fed up of loosing my quick debug statements and so added the line name and file number from a stack trace (substitute var_export() to taste).
function pr($str){
echo('');
print_r($str);
echo('
');
$d = debug_backtrace();
echo $d[0]['file'] . '
Line: ' . $d[0]['line'] . '';
echo '
';
}