← All docs

sort() — internals

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

sort() — internals

Where it lives

Lowering notes

  • Lowers sort() for indexed integer arrays by mutating the source array in place.

Runtime helpers

The following runtime helpers are referenced:

  • __rt_arsort
  • __rt_asort
  • __rt_krsort
  • __rt_ksort
  • __rt_rsort_int
  • __rt_rsort_str
  • __rt_sort_int
  • __rt_sort_str

Signature summary

function sort(array $array): bool

What the type checker enforces

  • Arity: takes exactly 1 argument.
  • By-reference parameters: $array.

Eval interpreter (magician)

Cross-references