Substr_count() function
substr_count function will count the number of substring occurrences in a string
Syntax :int substr_count ( string haystack, string needle)
int substr_count ( string haystack, string needle)Example :$input = “This is sample text which will count substring sample”;
$input = “This is sample text which will count substring sample”;$output= substr_count($input, “sample”);
echo $output; // prints out 2
