
What happens when PHP runs your code
A request walks from the SAPI to the Zend VM — lexing, compilation to opcodes, the OPcache lookup that skips both, and execution.
A technical publication about PHP internals, performance, architecture, and production behavior — measurements over assumptions, trade-offs over rules.

A request walks from the SAPI to the Zend VM — lexing, compilation to opcodes, the OPcache lookup that skips both, and execution.

Walking an array with foreach ($rows as &$row) wraps every element in a zend_reference. On a million integers that is 32 MB the loop never gives back.

A zval is sixteen bytes, a value union and a type tag. What that tag says decides whether an assignment copies anything, what a reference costs, and which variable pays.

pm static, dynamic and ondemand, the memory ceiling nothing enforces, and how to size a pool from measurements rather than guesses.

Container compilation moves reflection from request time to build time. What that removes, what it costs, and when it matters.

One structure serves as list, dictionary and set. Packed and hashed layouts, what each costs in memory, and when a conversion happens.

OPcache removes compilation, not execution. The JIT reaches arithmetic-heavy code and little else. Where the remaining time lives.