← All docs

substr() — internals

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

substr() — internals

Where it lives

Lowering notes

  • Lowers substr(string, offset, length?) with target-local pointer arithmetic.

Runtime helpers

The following runtime helpers are referenced:

  • __rt_substr_replace

Signature summary

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

What the type checker enforces

  • Arity: takes 2–3 arguments (1 optional).

Eval interpreter (magician)

Cross-references