Skip to content

Instantly share code, notes, and snippets.

@ryun
Created January 18, 2014 00:46
Show Gist options
  • Select an option

  • Save ryun/8484467 to your computer and use it in GitHub Desktop.

Select an option

Save ryun/8484467 to your computer and use it in GitHub Desktop.
Outputs the given variable with formatting and location
<?php
if ( ! function_exists('dump'))
{
function dump()
{
list($callee) = debug_backtrace();
$arguments = $callee['args'];
$total_arguments = count($arguments);
echo '<fieldset style="background: #fefefe !important; border:2px red solid; padding:5px">';
echo '<legend style="background:lightgrey; padding:5px;">'.$callee['file'].' @ line: '.$callee['line'].'</legend><pre>';
$i = 0;
foreach ($arguments as $argument) {
echo '<br/><strong>Debug #'.(++$i).' of '.$total_arguments.'</strong>: ';
var_dump($argument);
}
echo '</pre>';
echo '</fieldset>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment