note 78551 deleted from ref.array by nlopess
| From: | nlopess@php.net | Date: | Fri, 19 Oct 2007 18:57:02 +0000 |
| Subject: | note 78551 deleted from ref.array by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-131563@lists.php.net to get a copy of this message | ||
Note Submitter: Hayley Watson
----
Yet Another Yet Another reimplementation. This one finds the maximum array nesting a la the post by
ob at babcom dot biz, boesn't generate "Undefined variable" notices.
<?php
function maximum_array_depth($array)
{
if(!is_array($array)) return 0;
return 1+max(array_map('maximum_array_depth', $array));
}
$t1 = array(0,1,2,array(3,4),5,array(array(6),array(7,8),9));
echo maximum_array_depth($t1);
?>