note 49219 added to ref.array
| From: | (a) | Date: | Thu, 20 Jan 2005 16:18:55 +0000 |
| Subject: | note 49219 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83684@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49219
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49219&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49219&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49219&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49219&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49219&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49219&report=yes
Search -- http://master.php.net/manage/user-notes.php