note 19658 deleted from function.count by philip

From: Date: Fri, 13 Dec 2002 00:30:38 +0000
Subject: note 19658 deleted from function.count by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40840@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.

« previous php.notes (#40840) next »