Created
November 22, 2012 02:43
-
-
Save cornernote/4129160 to your computer and use it in GitHub Desktop.
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
| /** | |
| * Debug the target with syntax highlighting on by default. | |
| * @param null $var | |
| * @param null $name | |
| */ | |
| function debug($var = null, $name = null) | |
| { | |
| $bt = debug_backtrace(); | |
| if ($name !== false) { | |
| $file = str_replace(bp(), '', $bt[0]['file']); | |
| print '<div style="background: #FFFBD6">'; | |
| if ($name) | |
| $name = '<b>' . $name . '</b><br/>'; | |
| print '<span style="font-size:12px;">' . $name . ' ' . $file . ' on line ' . $bt[0]['line'] . '</span>'; | |
| print '<div style="border:1px solid #000;">'; | |
| } | |
| print '<pre>'; | |
| print_r($var); | |
| print '</pre>'; | |
| if ($name !== false) { | |
| print '</div>'; | |
| print '</div>'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment