Created
July 10, 2014 13:53
-
-
Save javierarques/2a2cd1a623cf7cba99e4 to your computer and use it in GitHub Desktop.
Prints out the content of a variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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