substr_count() function returns the number of times substring occurs in string. : substr_count « String « PHP






substr_count() function returns the number of times substring occurs in string.

 
Its syntax is: int substr_count (string string, string substring)

<?
$tng_twist = "The rain";
$count = substr_count($tng_twist, "ain");
print $count;
?>
  
  








Related examples in the same category

1.Counting the Occurrences of a Substring
2.Testing for Substrings
3.substr_count.php