[Solved] How to find the depth of an unlimited depthed array [duplicate]

Try this man function array_depth($array, $n = 0) { $max_depth = 1; foreach ($array as $value) { if (isset($value[‘subcategories’][0])) { $depth = $this -> array_depth($value[‘subcategories’]) + 1; if ($depth > $max_depth) { $max_depth = $depth; } } } return $max_depth; } 1 solved How to find the depth of an unlimited depthed array [duplicate]