Skip to content

Instantly share code, notes, and snippets.

@alexbabintsev
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexbabintsev/e40629a3973866e5336c to your computer and use it in GitHub Desktop.
Save alexbabintsev/e40629a3973866e5336c to your computer and use it in GitHub Desktop.
Yii2: отладка переменных
<?php
/**
* Debug function
* d($var);
*/
function d($var,$caller=null)
{
if (!isset($caller)){
$caller = array_shift(debug_backtrace(1));
}
echo '<code>File: '.$caller['file'].' / Line: '.$caller['line'].'</code>';
echo '<pre>';
yii\helpers\VarDumper::dump($var, 10, true);
echo '</pre>';
}
/**
* Debug function with die() after
* dd($var);
*/
function dd($var)
{
$caller = array_shift(debug_backtrace(1));
d($var,$caller);
die();
}
/* Include debug functions */
require_once(__DIR__.'/functions.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment