Re: Counting elements in an array

From: Date: Wed, 19 Nov 2003 15:51:36 +0000
Subject: Re: Counting elements in an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170303@lists.php.net to get a copy of this message
On Wednesday 19 November 2003 23:24, 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"? array_count_values() -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* They also surf who only stand on waves. */

« previous php.general (#170303) next »