Re: Counting elements in an array

From: Date: Wed, 19 Nov 2003 17:59:10 +0000
Subject: Re: Counting elements in an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170329@lists.php.net to get a copy of this message
Jeff McKeon wrote:
How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is "orange"? Thanks, Jeff
$temp = array_keys ( $fruit, "orange" ); echo ( sizeof ( $temp ) ); -- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#170329) next »