src/Neutrino/Debug/VarDump.php
private function checkArrayRecursion(array $var)
    {
        static $dump;

        if (!isset($dump)) {
            $dump = [];
        }

        if (in_array($var, $dump, true)) {
            return true;
        }

        $dump[] = $var;

        $return = false;

        foreach ($var as $item) {
            if (is_object($item) && $this->checkObjectRecursion($item)) {
                $return = true;
                break;
            }
            if (is_array($item) && $this->checkArrayRecursion($item)) {
                $return = true;
                break;
            }
        }

        array_pop($dump);

        return $return;
    }
private function checkArrayRecursion(array $var)
    {
        static $dump;

        if (!isset($dump)) {
            $dump = [];
        }

        if (in_array($var, $dump, true)) {
            return true;
        }

        $dump[] = $var;

        $return = false;

        foreach ($var as $item) {
            if (is_object($item) && $this->checkObjectRecursion($item)) {
                $return = true;
                break;
            }
            if (is_array($item) && $this->checkArrayRecursion($item)) {
                $return = true;
                break;
            }
        }

        array_pop($dump);

        return $return;
    }
Check if an array contains any recursion

@param array $var

@return bool