substr_count Count the number of substring occurrences &reftitle.description; intsubstr_count stringhaystack stringneedle intoffset intlength substr_count returns the number of times the needle substring occurs in the haystack string. Please note that needle is case sensitive. This function doesn't count overlapped substrings. See the example below! &reftitle.parameters; haystack The string to search in needle The substring to search for offset The offset where to start counting length The maximum length after the specified offset to search for the substring. It outputs a warning if the offset plus the length is greater than the haystack length. &reftitle.returnvalues; This functions returns an integer. &reftitle.changelog; &Version; &Description; 5.1.0 Added the offset and the length parameters &reftitle.examples; A <function>substr_count</function> example 14 echo substr_count($text, 'is', 5, 10); // prints only 1, because it doesn't count overlapped subtrings $text2 = 'gcdgcdgcd'; echo substr_count($text2, 'gcdgcd'); ?> ]]> &reftitle.seealso; count_chars strpos substr strstr