Skip to content

Added new method - isNested and getDepth

Compare
Choose a tag to compare
@minwork minwork released this 27 May 06:53
· 53 commits to master since this release

isNested

Check if any element of an array is also an array.

For example [1, 2, 3] is a regular array so it isn't nested and [1, 2 => [], 3] has another array as one of it's elements so it is nested.

getDepth

Get nesting depth of an array.

Taking example from above, [1, 2, 3] is a regular array so it has depth of 1 and [1, 2 => [], 3] has depth of 2 because of a second array in it. More detailed examples showing more complex cases can be found in documentation.