1. Perform lexical analysis on Scanning and convert PHP code into language fragments.
2. Parse Parsing and convert Tokens into simple and meaningful expressions.
3. Compile Compilation into Opcode.
4. Execute Execution and execute Opcode in sequence.
One at a time, the functions expressed by PHP code are realized.
Example
struct _zend_op { const void *handler; //The C language function corresponding to the execution, that is, each opcode has a C function to process znode_op op1; //Operation 1 znode_op op2; //operand 2 znode_op result; //return value uint32_t extended_value; uint32_t lineno; zend_uchar opcode; //opcode instruction zend_uchar op1_type; //operand 1 type zend_uchar op2_type; //operand 2 type zend_uchar result_type; //return value type};
The above is how the php Zend engine executes code. I hope it will be helpful to everyone. More PHP learning guide: source code network