Skip to content

Instantly share code, notes, and snippets.

@javierarques
Created July 10, 2014 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierarques/2a2cd1a623cf7cba99e4 to your computer and use it in GitHub Desktop.
Save javierarques/2a2cd1a623cf7cba99e4 to your computer and use it in GitHub Desktop.
Prints out the content of a variable
/**
* Prints the content of a variable
*/
function dump()
{
list($callee) = debug_backtrace();
$arguments = func_get_args();
$total_arguments = count($arguments);
echo '<fieldset style="background: #fefefe !important; border:2px red solid; padding:5px; font-size: 12px; color: #333; text-align: left">';
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>: ';
print_r($argument);
}
echo "</pre>";
echo "</fieldset>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment