Counting number of value instances within an array
| From: | Neil Freeman | Date: | Fri, 26 Apr 2002 11:24:01 +0000 |
| Subject: | Counting number of value instances within an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-94722@lists.php.net to get a copy of this message | ||
Hi guys,
Is there a function I can use to count the number of instances of a
value within an array. For example:
$a[0] = "bob";
$a[1] = "bob";
$a[2] = "fred";
$a[3] = "james";
$a[4] = "bob";
$a[5] = "carl";
Searching for 'bob' would return 3.
I've had a quick look through the array functions but didn't spot
anything obvious.
Neil
--------------------------------
Email: neil.freeman@asa.co.uk
neil@curvedvision.com
--------------------------------