← All docs

preg_replace()

Performs a regular expression search and replace.

preg_replace()

function preg_replace(string $pattern, string $replacement, string $subject): string

Performs a regular expression search and replace.

Parameters:

  • $pattern (string)
  • $replacement (string)
  • $subject (string)

Returns: string

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

Internals

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