← All docs

substr_replace()

Replaces text within a portion of a string.

substr_replace()

function substr_replace(string $string, string $replace, int $offset, int $length = null): string

Replaces text within a portion of a string.

Parameters:

  • $string (string)
  • $replace (string)
  • $offset (int)
  • $length (int), default null, optional

Returns: string

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

Internals

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