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

Reply via email to