How to get opcodes of PHP?

前端 未结 2 1182
执念已碎
执念已碎 2020-12-02 06:36
  

Its opcode is:

2条回答
  •  孤街浪徒
    2020-12-02 06:49

    Parsekit has parsekit_compile_string().

    sudo pecl install parsekit
    
    var_dump(parsekit_compile_string(<<
    
    

    The output is quite verbose, so you'd need to process it to get assembler-like format.

      ["opcodes"]=>
      array(10) {
        [0]=>
        array(9) {
          ["address"]=>
          int(44682716)
          ["opcode"]=>
          int(101)
          ["opcode_name"]=>
          string(13) "ZEND_EXT_STMT"
          ["flags"]=>
          int(4294967295)
          ["result"]=>
          array(8) {
            ["type"]=>
            int(8)
            ["type_name"]=>
            string(9) "IS_UNUSED"
            ["var"]=>
            int(0)
            ["opline_num"]=>
            string(1) "0"
            ["op_array"]=>
            string(1) "0"
            ["jmp_addr"]=>
            string(1) "0"
            ["jmp_offset"]=>
            string(8) "35419039"
            ["EA.type"]=>
            int(0)
          }
          ["op1"]=>
          array(8) {
            ["type"]=>
            int(8)
            ["type_name"]=>
            string(9) "IS_UNUSED"
            ["var"]=>
            int(0)
            ["opline_num"]=>
            string(1) "0"
            ["op_array"]=>
            string(1) "0"
            ["jmp_addr"]=>
            string(1) "0"
            ["jmp_offset"]=>
            string(8) "35419039"
            ["EA.type"]=>
            int(0)
          }
    

提交回复
热议问题