For instance
Code: Select all
$animals = Array = ('Dog', 'Cat', 'Dog', 'Goldfish', 'Dog', 'Bear', 'Cat');Any help would be appreciated, thanks,
Archy
Moderator: General Moderators
Code: Select all
$animals = Array = ('Dog', 'Cat', 'Dog', 'Goldfish', 'Dog', 'Bear', 'Cat');Code: Select all
$user_input = "Dog"; //could get value from a form
$animals = Array('Dog', 'Cat', 'Dog', 'Goldfish', 'Dog', 'Bear', 'Cat');
$animal_count = array_count_values($animals);
echo "There are ".$animal_count[$user_input]." occurence of your search";