Next: , Previous: , Up: Top   [Contents]


2 Opcodes in PHP

Before a PHP script can be executed in Zend VM, it is compiled into arrays of zend_ops. Similar to machine codes, a zend_op consists of an instruction, at most two operands, and the operation result.

struct _zend_op {
    const void *handler;         // Function pointer to opcode handler.
    znode_op    op1;             // First operand.
    znode_op    op2;             // Second operand.
    znode_op    result;          // Instruction result.
    uint32_t    extended_value;  // Extra data corresponding to this opline.
    uint32_t    lineno;          // Line numper of this opline.
    zend_uchar  opcode;          // Instruction code.
    zend_uchar  op1_type;        // Type of first operand.
    zend_uchar  op2_type;        // Type of second operand.
    zend_uchar  result_type;     // Type of instruction result.
};