Fw: [PHP] How to get count of dimensions in multi array?

From: Date: Mon, 23 Sep 2002 20:59:17 +0000
Subject: Fw: [PHP] How to get count of dimensions in multi array?
Groups: php.general 
Request: Send a blank email to php-general+get-117322@lists.php.net to get a copy of this message
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" <skarppost@hotmail.com> To: <php-general@lists.php.net> 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 >

« previous php.general (#117322) next »