How to use substr_count with an array as a needle. Like this:
开发者_StackOverflow中文版substr_count($str, array('find_this', 'or_find_this'));
You could use implode() to create a string of the array and create a regex kind of thing.
$array = array('find_this', 'or_find_this');
$string = implode('|', $array);
$count = count(preg_grep("/($string)/", $str));
echo $count;
You'll need to loop through them and add the substr_count() to the total count. A ready example is in the php manual page,
http://www.php.net/manual/en/function.substr-count.php#74952
精彩评论