note 85924 added to function.array-values
| From: | chrysb at gmail dot com | Date: | Wed, 24 Sep 2008 19:34:30 +0000 |
| Subject: | note 85924 added to function.array-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144684@lists.php.net to get a copy of this message | ||
If you are looking for a way to count the total number of times a specific value appears in array,
use this function:
function array_value_count ($match, $array)
{
$count = 0;
foreach ($array as $key => $value)
{
if ($value == $match)
{
$count++;
}
}
return $count;
}
This should really be a native function of PHP.
----
Server IP: 64.71.164.2
Probable Submitter: 67.180.181.229
----
Manual Page -- http://www.php.net/manual/en/function.array-values.php
Edit -- https://master.php.net/note/edit/85924
Del: integrated -- https://master.php.net/note/delete/85924/integrated
Del: useless -- https://master.php.net/note/delete/85924/useless
Del: bad code -- https://master.php.net/note/delete/85924/bad+code
Del: spam -- https://master.php.net/note/delete/85924/spam
Del: non-english -- https://master.php.net/note/delete/85924/non-english
Del: in docs -- https://master.php.net/note/delete/85924/in+docs
Del: other reasons-- https://master.php.net/note/delete/85924
Reject -- https://master.php.net/note/reject/85924
Search -- https://master.php.net/manage/user-notes.php