MB_SUBSTR_COUNT(3) 1 MB_SUBSTR_COUNT(3)
mb_substr_count - Count the number of substring occurrences
SYNOPSIS
int mb_substr_count (string $haystack, string $needle, [string $encoding = mb_internal_encoding()])
DESCRIPTION
Counts the number of times the $needle substring occurs in the $haystack string.
PARAMETERS
o $haystack
- The string being checked.
o $needle
- The string being found.
o $encoding
-The $encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
RETURN VALUES
The number of times the $needle substring occurs in the $haystack string.
EXAMPLES
Example #1
mb_substr_count(3) example
<?php
echo mb_substr_count("This is a test", "is"); // prints out 2
?>
SEE ALSO
mb_strpos(3), mb_substr(3), substr_count(3).
PHP Documentation Group MB_SUBSTR_COUNT(3)