Re: sizeof($array) with a twist

From: Date: Tue, 04 Dec 2001 16:38:37 +0000
Subject: Re: sizeof($array) with a twist
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-76540@lists.php.net to get a copy of this message
array_count_values() does something like this. It groups together values and tells you how many times they occur in an array... example ------------------------ $array = array( array("foo","bar","rex"), array("foo","bar","zip"), array("foo","bar","zoo"), array("foo","bar","rex")); /* put all elements into one array */ foreach($array as $val) { $temp_array[] = $val[2];} /* count values. see php.net/array_count_values */ $count = array_count_values($temp_array); print"<pre>"; print_r($count); print"</pre>"; -------------------- this produces ... Array (
    [rex] => 2
    [zip] => 1
    [zoo] => 1
)
I'd like to count the number of rows in a 2 dimensional array that have the same data in their fifth field. Is there a PHP function that does this? Sizeof() appears to lack condition parameters... ...Rene --- René Fournier renefournier@yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- Jim Musil --------- Multimedia Programmer Nettmedia ------------- 212-629-0004 jim@nettmedia.com

« previous php.general (#76540) next »