/** * 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>'; }
function print_pre($var, $header = null, $debug = true, $return = false, $depth = 3, $highlight = null) { if (!isset($highlight)) { $highlight = false; } if ($debug && YII_DEBUG) { \Yii::trace($header . ' ' . yii\helpers\VarDumper::dumpAsString($var, $depth, $highlight), 'firebug'); } else { $html = ''; if ($header) { $html = "<strong>" . $header . "</strong>\n"; } $html .= "\n<pre class='debug'>"; //$html .= print_r($var, true); $html .= yii\helpers\VarDumper::dumpAsString($var, $depth, $highlight); $html .= "</pre>\n"; if ($return) { return $html; } echo $html; } }
public static function dump($var, $depth = 10, $highlight = true, $echo = true) { $vard = new \yii\helpers\VarDumper(); if ($echo === true) { echo $vard->dumpAsString($var, $depth, $highlight); } else { return $vard->dumpAsString($var, $depth, $highlight); } }
function dump($model,$die=true){ yii\helpers\VarDumper::dump($model,10,true); if($die) exit; }
function dump($target) { return yii\helpers\VarDumper::dump($target, 10, true); }