diff --git a/Classes/Utility/ArrayUtility.php b/Classes/Utility/ArrayUtility.php index 0c0da26..c763526 100644 --- a/Classes/Utility/ArrayUtility.php +++ b/Classes/Utility/ArrayUtility.php @@ -67,4 +67,20 @@ class ArrayUtility return array_keys($arr) !== range(0, count($arr) - 1); } + /** + * Returns the depth of an array + */ + function depth(array $array) { + $depthMax = 1; + foreach ($array as $value) { + if (is_array($value)) { + $depth = self::depth($value) + 1; + if ($depth > $depthMax) { + $depthMax = $depth; + } + } + } + return $depthMax; + } + }