コード例 #1
0
ファイル: jsrt.php プロジェクト: michaelprem/phc
 function getValue()
 {
     echo "oops. trying to read " . $this->propName . ", but that's not defined.<hr>";
     throw new js_exception(new js_referenceerror(dump_object($this)));
 }
コード例 #2
0
 function dump_array($params, &$data, $level = 1, $ignore = array(), $accessor)
 {
     $maxlevel = 3;
     if (isset($params['maxlevel'])) {
         $maxlevel = (int) $params['maxlevel'];
         $maxlevel = max(1, $maxlevel);
         $maxlevel = min(10, $maxlevel);
     }
     if ($level > $maxlevel) {
         return;
     }
     $str = '';
     foreach ($data as $key => $value) {
         $acc = build_accessor($accessor, 'array', $key);
         $type = gettype($value);
         if (is_object($value)) {
             $str .= str_repeat('  ', $level) . '- <u>' . $key . ' = Object</u> <em>{$' . $acc . '}</em><br/>';
             if (isset($params['recurse'])) {
                 $str .= dump_object($params, $value, $level + 1, $ignore, $acc);
             }
         } else {
             if (is_array($value)) {
                 $str .= str_repeat('  ', $level) . "- <u>{$key} = Array (" . count($value) . ')</u> <em>{$' . $acc . '}</em><br/>';
                 if (isset($params['recurse'])) {
                     $str .= dump_array($params, $value, $level + 1, $ignore, $acc);
                 }
             } else {
                 if ($type == 'NULL') {
                     $str .= str_repeat('  ', $level) . '- ' . $name . ': NULL <em>{$' . $acc . '\\}</em><br/>';
                 } else {
                     $str .= str_repeat('  ', $level) . "- {$key} = " . cms_htmlentities($value) . ' {$' . $acc . '}<br/>';
                 }
             }
         }
     }
     return $str;
 }
コード例 #3
0
ファイル: vardump.php プロジェクト: Sywooch/dobox
/**
 * Works in conjunction with the debug function to pretty-print a variable of arbitrary type.
 *
 * @return string
 * @param mixed $var A reference to the variable to pretty-print
 * @param bool $b_verbose A boolean that indicates whether to print verbose output.
 * @param int $i_indent The current intendation level.
 */
function dump_arbitrary(&$var, $b_verbose = false, $i_indent = 0, $str_unique_id = '')
{
    // if the var is an array, recurse...
    if (is_array($var)) {
        dump_array($var, $b_verbose, $i_indent);
    } else {
        if (is_object($var)) {
            dump_object($var, $b_verbose, $i_indent);
        } else {
            dump_scalar($var, $b_verbose, $str_unique_id);
        }
    }
}