I'm having very simple issue. I have array
$a = array('dog', 'dog', 'dog', 'mouse', 'mouse','mouse', 'cat','cat');
How to count how many elements called 'dog' I have ?
I tried count()
function , i know it's not good because count doesn't look into array only counts number of elements.
So for example answer for my issue would be :
dog = 3
mouse = 3
cat = 2