Skip to content

Instantly share code, notes, and snippets.

@tucq88
Last active August 29, 2015 14:10
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 tucq88/7e8652ccd84eb0cef141 to your computer and use it in GitHub Desktop.
Save tucq88/7e8652ccd84eb0cef141 to your computer and use it in GitHub Desktop.
Snippet - PHP
function debug($var) {
echo '<pre style="text-align: left;font-size: 14px;">';
$trace = debug_backtrace();
echo 'Line: ' . $trace[0]['line'] . '<br>';
print_r($var);
echo '</pre>';
}
function debug_plus()
{
$args = func_get_args();
$trace = debug_backtrace();
foreach($args as $k => $arg){
echo '<fieldset class="debug">
<legend>(' . ($k+1) . ') Line : ' . $trace[0]['line'] . '</legend>';
print_r($arg); //Yii : CVarDumper::dump($arg, 10, true);
echo '</fieldset>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment