(Sadece PHP 5.3 ile çalışan) bir kapatma kullanarak yapabilirsiniz:
$comment = 'billie jean is not my lover she is just a girl';
$words = array('jean','lover','jean');
$lin = count(array_filter($words,function($word) use ($comment) {return strpos($comment,$word) !== false;}));
Ya da basit bir şekilde:
$comment = 'billie jean is not my lover she is just a girl';
$words = array('jean','lover','jean');
$lin = count(array_intersect($words,explode(" ",$comment)));
Sözcükler arasında mükemmel bir uyum varsa sadece dönecektir ikinci şekilde, substringler kabul edilmeyecektir.