$str = "PHP is what PHP is and PHP is not what PHP is not";
Now lets try to find out the no of occurrence of the word 'PHP' in above string..
$cnt = count(explode("PHP",$str))-1;
echo $cnt;
This will print 4.
There are many alternative option to do the same this in php..