← All docs

microtime() — internals

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

microtime() — internals

Where it lives

Lowering notes

  • Lowers microtime() / microtime(true) / microtime(false) / microtime($flag).
  • Dispatch is driven by the arg-aware result type set in ir_lower (see
  • call_return_type_for_args and the microtime fallback in call_return_type):
  • Float (literal true) calls the existing __rt_microtime float helper; Str
  • (omitted / literal false) calls __rt_microtime_str, which builds the
  • “0.NNNNNNNN sec” string on the stack and persists it; Mixed (non-literal flag)
  • marshals the flag and calls __rt_microtime_mixed, which branches at runtime and
  • boxes either the string or the float.

Runtime helpers

The following runtime helpers are referenced:

  • __rt_microtime
  • __rt_microtime_mixed
  • __rt_microtime_str

Signature summary

function microtime(bool $as_float = false): mixed

What the type checker enforces

  • Arity: takes 0–1 arguments (1 optional).

Eval interpreter (magician)

Cross-references