getDepth

Definition

1
Arr::getDepth(array $array): int
Copied!

Description

Get nesting depth of an array

Examples

1
Arr::getDepth([]) -> 1
2
3
Arr::getDepth([1, 2, 3]) -> 1
4
5
Arr::getDepth([1, 2 => [], 3]) -> 2
6
7
Arr::getDepth([
8
1,
9
2 => [
10
3 => [
11
4 => []
12
]
13
],
14
5 => []
15
]) -> 4
Copied!
Last modified 2yr ago
Copy link