note 19658 added to function.count

From: Date: Thu, 07 Mar 2002 01:18:19 +0000
Subject: note 19658 added to function.count
Groups: php.notes 
Request: Send a blank email to php-notes+get-27445@lists.php.net to get a copy of this message
A function that counts an array's dimensions: // Counts number of vertical levels (subarrays) in a PHP array's // left-most branch, ie, in the first depth-first descent. function array_dimen_cnt( $arr ) { // Returns $dimen_cnt. // *************** $dimen_cnt = 0; while( is_array( $arr )): $dimen_cnt++; // reset() returns the value of the first array element: $arr = reset( $arr ); // Descend 1 level. endwhile; return $dimen_cnt; } // function array_dimen_cnt. -- http://www.php.net/manual/en/function.count.php http://master.php.net/manage/user-notes.php?action=edit+19658 http://master.php.net/manage/user-notes.php?action=delete+19658 http://master.php.net/manage/user-notes.php?action=reject+19658

« previous php.notes (#27445) next »