← All docs

mb_substr_count()

Counts non-overlapping occurrences of an encoded substring.

mb_substr_count()

function mb_substr_count(string $haystack, string $needle, ?string $encoding = null): int

Counts non-overlapping occurrences of an encoded substring.

Parameters:

  • $haystack (string)
  • $needle (string)
  • $encoding (?string), default null, optional

Returns: int

Availability

No examples yet. Check examples/ and showcases/ for usage patterns.

Internals

For how mb_substr_count is implemented in the compiler, see the internals page.