Last Updated: February 25, 2016
·
690
· kachar

Yii var dumper wrapper

function dumper(){
    $bt = debug_backtrace();
    $file = $bt[0]['file'].':'.$bt[0]['line'];
    $args = func_get_args();
    if(count($args)==0 && isset($bt[1]))
        $args[] = $bt[1];
    foreach($args as $arg){
        echo '<pre style="position:relative;">';
        echo '<span style="color:#777; right:10px; position:absolute;">'.$file.'</span>';
        CVarDumper::dump($arg, 10, true);
        echo '</pre>';
    }
}

Usage:

dumper($variable);
dumper($var1, $var2, $var3);

When no parameters are added info on the current location of the dumper is given:

dumper();