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);
printpre;
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
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]