note 49219 deleted from ref.array by levim
| From: | levim@php.net | Date: | Tue, 06 May 2014 22:01:50 +0000 |
| Subject: | note 49219 deleted from ref.array by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199445@lists.php.net to get a copy of this message | ||
Note Submitter: m227(a)poczta.onet.pl
----
How to count dimensions in multi-array? (corrected)
previous version didn't work when called more than one time.
($dimcount was preserved from previous call)
This is the way I corrected this:
function countdim($array)
{
if (is_array(reset($array)))
$return = countdim(reset($array)) + 1;
else
$return = 1;
return $return;
}
This function will return int number of array dimensions.