note 78551 added to ref.array
| From: | HayleyWatson at osu1 dot php dot net | Date: | Wed, 17 Oct 2007 03:40:54 +0000 |
| Subject: | note 78551 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131444@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 203.89.181.186
Probable Submitter: 60.234.168.92
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- https://master.php.net/note/edit/78551
Del: integrated -- https://master.php.net/note/delete/78551/integrated
Del: useless -- https://master.php.net/note/delete/78551/useless
Del: bad code -- https://master.php.net/note/delete/78551/bad+code
Del: spam -- https://master.php.net/note/delete/78551/spam
Del: non-english -- https://master.php.net/note/delete/78551/non-english
Del: in docs -- https://master.php.net/note/delete/78551/in+docs
Del: other reasons-- https://master.php.net/note/delete/78551
Reject -- https://master.php.net/note/reject/78551
Search -- https://master.php.net/manage/user-notes.php