← All docs

preg_match() — internals

Compiler internals for preg_match(): lowering path, type checks, and runtime helpers.

preg_match() — internals

Where it lives

Lowering notes

  • Lowers preg_match(pattern, subject) through the shared regex runtime helper.

Runtime helpers

The following runtime helpers are referenced:

  • __rt_preg_match
  • __rt_preg_match_capture

Signature summary

function preg_match(string $pattern, string $subject, array $matches = []): int

What the type checker enforces

  • Arity: takes 2–3 arguments (1 optional).
  • By-reference parameters: $matches.

Eval interpreter (magician)

Cross-references