public static function dump($var, $maxdepth = 10, $maxValueLen = 255, $stack = [])
    {
        $children = $hierarchyNotation = null;

        if (is_object($var)) {
            $children = get_object_vars($var);
            $hierarchyNotation = '->%s';
        } elseif (is_array($var)) {
            $children = $var;
            $hierarchyNotation = '[%s]';
        }


        if (isset($children)) {
            $ret = self::formatDumpStack($stack, $var);

            if ($maxdepth >= 0 && count($stack) == $maxdepth) {
                $ret .= ' (...)' . "\n";
            } else {
                if (count($children) == 0) {
                    $ret .= "(empty)\n";
                } else {
                    $ret .= "\n";

                    $i = 0;
                    foreach ($children as $name => $value) {
                        array_push($stack, sprintf($hierarchyNotation, $name));
                        $ret .= self::dump($value, $maxdepth, $maxValueLen, $stack);
                        array_pop($stack);
                        $i++;
                    }
                }
            }
        } else {
            $val = self::dumpScalar($var, $maxValueLen);
            if ($stack) {
                $ret = join('', $stack) . ' = ' . $val;
            } else {
                $ret = $val;
            }
            $ret .= "\n";
        }
        return $ret;
    }
public static function dump($var, $maxdepth = 10, $maxValueLen = 255, $stack = [])
    {
        $children = $hierarchyNotation = null;

        if (is_object($var)) {
            $children = get_object_vars($var);
            $hierarchyNotation = '->%s';
        } elseif (is_array($var)) {
            $children = $var;
            $hierarchyNotation = '[%s]';
        }


        if (isset($children)) {
            $ret = self::formatDumpStack($stack, $var);

            if ($maxdepth >= 0 && count($stack) == $maxdepth) {
                $ret .= ' (...)' . "\n";
            } else {
                if (count($children) == 0) {
                    $ret .= "(empty)\n";
                } else {
                    $ret .= "\n";

                    $i = 0;
                    foreach ($children as $name => $value) {
                        array_push($stack, sprintf($hierarchyNotation, $name));
                        $ret .= self::dump($value, $maxdepth, $maxValueLen, $stack);
                        array_pop($stack);
                        $i++;
                    }
                }
            }
        } else {
            $val = self::dumpScalar($var, $maxValueLen);
            if ($stack) {
                $ret = join('', $stack) . ' = ' . $val;
            } else {
                $ret = $val;
            }
            $ret .= "\n";
        }
        return $ret;
    }
public static function dump ( $ var , $ maxdepth = 10 , $ maxValueLen = 255 , $ stack = [ ] ) { $ children = $ hierarchyNotation = null ; if ( is_object ( $ var ) ) { $ children = get_object_vars ( $ var ) ; $ hierarchyNotation = '->%s' ; } elseif ( is_array ( $ var ) ) { $ children = $ var ; $ hierarchyNotation = '[%s]' ; } if ( isset ( $ children ) ) { $ ret = self :: formatDumpStack ( $ stack , $ var ) ; if ( $ maxdepth >= 0 && count ( $ stack ) == $ maxdepth ) { $ ret .= ' (...)' . "\n" ; } else { if ( count ( $ children ) == 0 ) { $ ret .= "(empty)\n" ; } else { $ ret .= "\n" ; $ i = 0 ; foreach ( $ children as $ name => $ value ) { array_push ( $ stack , sprintf ( $ hierarchyNotation , $ name ) ) ; $ ret .= self :: dump ( $ value , $ maxdepth , $ maxValueLen , $ stack ) ; array_pop ( $ stack ) ; $ i ++ ; } } } } else { $ val = self :: dumpScalar ( $ var , $ maxValueLen ) ; if ( $ stack ) { $ ret = join ( '' , $ stack ) . ' = ' . $ val ; } else { $ ret = $ val ; } $ ret .= "\n" ; } return $ ret ; }
Variable dumper.
Dumps variables in a PHP-syntax format.

@param mixed $var
@param int $maxdepth
@param int $maxValueLen
@param array $stack
@return string
Variable dumper . Dumps variables in a PHP - syntax format .