php math counting

Is there a function that allow you to take a list or column of various numbers like 0-9 and ,let’s say, count the number of 2’s in it? Just to be clear, I don’t mean to total it to get the sum.

[php]$number_array = array(2,4,5,‘7’,1,3,‘2’,5,2);
$num_to_find = ‘2’;
echo count(array_keys($number_array,$num_to_find)); //outputs 3[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service