Here.. I wrote this simple recursive function for a project a while back.
Enjoy..
<?
echo matrixdepth($myarray);
function matrixdepth($array, $depth = 1)
{
foreach ($array as $key => $val)
{
if (is_array($array[$key]))
{
$depth++;
matrixdepth($array[$key], $depth);
}
else
{
break;
}
}
return $depth;
}
?>
-Kevin
----- Original Message -----
From: "Stefan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 1:45 PM
Subject: [PHP] How to get count of dimensions in multi array?
> Hello,
> I�m trying to figer out how to get the number och dimensions of a array..
> It isn�t the problem to get the count of elements with count(), it�s the
> number of dimensions i am stuck at :(
>
> Any tips would be appreciated.
> Best regards,
> Stefan
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php