note 64257 deleted from function.array-count-values by bjori

From: Date: Tue, 11 Apr 2006 11:44:55 +0000
Subject: note 64257 deleted from function.array-count-values by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107767@lists.php.net to get a copy of this message
Note Submitter: jd.bell located at good 'ol gmail Reason: useless ---- (eat that webbots!) I believe counting multi-dimensional arrays has been built into PHP since 4.2: <?php $star_wars = array( 'jedi' => array( 'yoda', 'obi-wan kenobi', 'luke skywalker' ), 'sith' => array( 'darth maul', 'darth sidious', 'darth vader' ), 'other' => array( 'wicket', 'han solo', 'chewbaca' ) ); // counting elements from all dimensions echo "<br>" . count( $star_wars, COUNT_RECURSIVE ); // output 12 // counting only second dimension elements echo "<br>" . ( count( $star_wars, COUNT_RECURSIVE ) - count( $star_wars ) ); // output 9 ?>

« previous php.notes (#107767) next »