Occurrences within an array
Posted: Tue May 03, 2005 9:19 am
Hi, I'm currently having a small problem in finding out how many times a string occurs in an array - without looping through and testing every element within it.
For instance
So, if I did a search for 'Dog', it would return '3', and 'Cat' would return '2'etc.
Any help would be appreciated, thanks,
Archy
For instance
Code: Select all
$animals = Array = ('Dog', 'Cat', 'Dog', 'Goldfish', 'Dog', 'Bear', 'Cat');Any help would be appreciated, thanks,
Archy