Is there a way to find how how "deep" a PHP array is?

Posted by Thomas Owens on Stack Overflow See other posts from Stack Overflow or by Thomas Owens
Published on 2008-11-04T18:44:37Z Indexed on 2010/04/13 12:53 UTC
Read the original article Hit count: 324

Filed under:
|
|

A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, 2 if at least one element is an array, and so on.

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays