This document provides an overview of PHP's virtual machine. It discusses how PHP works internally, including:
- PHP is interpreted by a software virtual machine written in C called the Zend Engine.
- The Zend Engine compiles PHP code to opcodes, performs optimizations, and then executes the opcodes by interpreting them one by one.
- Key parts of the compilation process include lexical analysis, semantic analysis/parsing, and opcode generation. Optimizations are then performed by the opcache extension.
- Execution involves interpreting each opcode through handler functions. Common opcodes like ZEND_ECHO and ZEND_CONCAT are discussed as examples.
- The opcode cache stores pre-compiled code