← All docs

str_replace()

Replaces all occurrences of a search string with a replacement string.

str_replace()

function str_replace(string $search, string $replace, string $subject, int $count = null): string

Replaces all occurrences of a search string with a replacement string.

Parameters:

  • $search (string)
  • $replace (string)
  • $subject (string)
  • $count (int), default null, optional

Returns: string

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

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