note 35226 added to ref.array
| From: | szymon at mazurek dot info | Date: | Sun, 24 Aug 2003 10:46:40 +0000 |
| Subject: | note 35226 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54984@lists.php.net to get a copy of this message | ||
How to count dimensions in multi-array?
This is the way I do this:
function countdim($array) {
static $dimcount = 1;
if (is_array(reset($array))) {
$dimcount++;
$return = countdim(reset($array));
} else {
$return = $dimcount;
}
return $return;
}
This function will return int number of array dimensions.
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35226
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35226&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35226&report=yes