Its operation code is: 1...">

How to get PHP opcodes?

<?php $show_value = 123; echo 'sing_quote'.$show_value; echo "double_quote{$show_value}"; ?> 

Its operation code is:

 1: <?php 2: $show_value = 123; 0 ASSIGN !0, 123 3: echo 'sing_quote'.$show_value; 1 CONCAT 'sing_quote', !0 =>RES[~1] 2 ECHO ~1 4: echo "double_quote{$show_value}"; 3 ADD_STRING 'double_quote' =>RES[~2] 4 ADD_VAR ~2, !0 =>RES[~2] 5 ECHO ~2 6 RETURN 1 
+61
php opcode
Nov 25 '09 at 8:22
source share
2 answers

See the Vulcan Logic Disassembler PECL Extension - see the authorโ€™s home page for more information.

The keys to dismantle the Vulcan Logic Disassembler into the Zend engine and resets all opcodes (actuators) of the script. It was written as the beginning of the encoder, but I did not have time for that. It can be used to see what happens in the Zend Engine.

After installation, you can use it as follows:

 php -d vld.active=1 -d vld.execute=0 -f yourscript.php 

See also an interesting blog post about extracting the opcode and PHP on the manual page for available opcodes .

+35
Nov 25 '09 at 8:28
source share

Parsekit has parsekit_compile_string () .

 sudo pecl install parsekit 
 var_dump (parsekit_compile_string (<<< PHP
  \ $ show_value = 123;
  echo 'sing_quote'. \ $ show_value;
  echo "double_quote {\ $ show_value}";
 Php
 ));

The output is pretty detailed, so you need to process it to get an assembler 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)
       }
+11
Feb 28 2018-12-12T00:
source share



All Articles