Skip to content

Instantly share code, notes, and snippets.

@subodhghulaxe
Last active August 29, 2015 14:04
Show Gist options
  • Save subodhghulaxe/39f58def872568b436dc to your computer and use it in GitHub Desktop.
Save subodhghulaxe/39f58def872568b436dc to your computer and use it in GitHub Desktop.
PHP debug function
<?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