SyntaxFix
Write A Post
Hire A Developer
Questions
define( 'SEARCH_STRING', 'Ben' ); $myArray = array("Kyle","Ben","Sue","Phil","Ben","Mary","Sue","Ben"); $count = count(array_filter($myArray,function($value){return SEARCH_STRING === $value;})); echo $count, "\n";
Output:
3