Esempio n. 1
0
function dump($var)
{
    @header('Content-Type: text/html; charset=UTF-8');
    //русский текст пиздит!
    $arg_list = func_get_args();
    foreach ($arg_list as $arg) {
        echo dump_str($arg);
    }
}
function dump_str($var, $indent = 0)
{
    $res = '';
    if (is_array($var) || is_object($var)) {
        $spc = '';
        for ($i = 0; $i < $indent; $i++) {
            $spc .= '  ';
        }
        $sz = 0;
        foreach ($var as $k) {
            $sz++;
        }
        if (is_array($var)) {
            $res .= 'array(' . $sz . ") {\n";
        } else {
            $res .= 'object(' . get_class($var) . ') (' . $sz . ") {\n";
        }
        foreach ($var as $k => $v) {
            $res .= "{$spc}  [\"{$k}\"] => " . dump_str($v, $indent + 1);
        }
        $res .= $spc . '}';
    } elseif (is_null($var)) {
        $res .= 'null';
    } elseif (is_string($var)) {
        $res .= 'string(' . strlen($var) . ') "' . str_replace('"', '\\"', $var) . '"';
    } else {
        $res .= $var;
    }
    $res .= "\n";
    return $res;
}
 function __construct()
 {
     $this->_start_time = get_microtime();
     if (DEBUG) {
         dwrite("**[Page processing begin]**");
         if (conf('page.show_vars', false)) {
             dwrite_msg('GET', dump_str($_GET));
             dwrite_msg('POST', dump_str($_POST));
             dwrite_msg('SESSION', dump_str($_SESSION));
             dwrite_msg('FILES', dump_str($_FILES));
             dwrite_msg('COOKIE', dump_str($_COOKIE));
         }
     }
     $this->fill_templates_paths();
 }
Esempio n. 4
0
function dump($obj)
{
    debug(dump_str($obj));
}