Pedro Chagas
asked on
Check how many times specific value in array PHP
Hi E's,
I have this code to check how many times specific value appears in php array:
The best regards,
JC
I have this code to check how many times specific value appears in php array:
$number = count(array_filter($arr_geral,function($a) {return $a=="some text example";}));
That code work if I put the text inside, but don't work if I put a varible:$text = "some text example";
$number = count(array_filter($arr_geral,function($a) {return $a==$text;}));
What changes I have to do, for the above code work with a variable?The best regards,
JC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.