public static function depth(array $array) : int
    {
        $maxDepth = 1;

        foreach ($array as $value) {
            if (is_array($value)) {
                $depth = self::depth($value) + 1;

                if ($depth > $maxDepth) {
                    $maxDepth = $depth;
                }
            }
        }

        return $maxDepth;
    }
public static function depth(array $array) : int
    {
        $maxDepth = 1;

        foreach ($array as $value) {
            if (is_array($value)) {
                $depth = self::depth($value) + 1;

                if ($depth > $maxDepth) {
                    $maxDepth = $depth;
                }
            }
        }

        return $maxDepth;
    }
public static function depth ( array $ array ) : int { $ maxDepth = 1 ; foreach ( $ array as $ value ) { if ( is_array ( $ value ) ) { $ depth = self :: depth ( $ value ) + 1 ; if ( $ depth > $ maxDepth ) { $ maxDepth = $ depth ; } } } return $ maxDepth ; }
Get depth of array

@param array $array

@return int
Get depth of array