substr_count < PHP
The substr_count function counts the number of substrings in a string.
$sentence = 'The quick brown fox jumped over the brown dog.';
$sentenceSubstrCount = substr_count($sentence, 'brown');
echo $sentenceSubstrCount;
// 2