(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
mb_substr_count — Count the number of substring occurrences
$haystack
$needle
$encoding
null
Counts the number of times the needle substring occurs in the haystack string.
needle
haystack
The string being checked.
The string being found.
encoding
Параметром encoding вказується кодування символів. Якщо він пропущений або null, використається внутрішнє кодування.
The number of times the needle substring occurs in the haystack string.
Приклад #1 mb_substr_count() example
<?phpecho mb_substr_count("This is a test", "is"); // prints out 2?>