Last active
August 29, 2015 14:04
-
-
Save subodhghulaxe/39f58def872568b436dc to your computer and use it in GitHub Desktop.
PHP debug function
This file contains 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
<?php | |
/** Debug function */ | |
function db($data) { | |
$backtrace = debug_backtrace(); | |
$caller = array_shift($backtrace); | |
echo '<br><pre style="color:#B99AFF;">##### <span style="color:green;">'.$caller['file'].'</span> <span style="color:red;">Line: '.$caller['line']. '</span> #####<br><span style="color:blue;">'; | |
if( !empty($data) ) { print_r( $data ); } else { print_r("Empty variable.<br>"); } | |
echo '</span>######################################################</pre><br>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment