I have a php string like as follows :
$string = 'www absjdjjd www123 dkkd www wwww ghy ww';
How to count the no. of words just only "www" present in this string.There are two words in this string so result should be 2. I have tried something like below but not working.
$val = 'www';
$count = substr_count($string, $val);