3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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; $arr = 1; for ($i = 0; $i < 5; $i++) { $v[$i] = 'hi'.$i; } return 'hi'; } } $arr = array('string' => new obj); array_walk_recursive($arr, 'settype');
based on n5E2r
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/WY0pB
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  11     1        NOP                                                      
  26     2        NEW                                              $2      :-6
         3        DO_FCALL                                      0          
         4        INIT_ARRAY                                       ~4      $2, 'string'
         5        ASSIGN                                                   !0, ~4
  27     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
Jump found. Position 1 = 12
Branch analysis from position: 12
Jump found. Position 1 = 14, Position 2 = 4
Branch analysis from position: 14
Jump found. Position 1 = -2
Branch analysis from position: 4
Jump found. Position 1 = 14, Position 2 = 4
Branch analysis from position: 14
Branch analysis from position: 4
filename:       /in/WY0pB
function name:  ptr2str
number of ops:  16
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                                                      ->12
   6     4    >   INIT_FCALL                                               'chr'
         5        BW_AND                                           ~5      !0, 255
         6        SEND_VAL                                                 ~5
         7        DO_ICALL                                         $6      
         8        ASSIGN_CONCAT                                 0          !1, $6
   7     9        ASSIGN_SR                                     0          !0, 8
   5    10        POST_INC                                         ~9      !2
        11        FREE                                                     ~9
        12    >   IS_SMALLER                                       ~10     !2, 8
        13      > JMPNZ                                                    ~10, ->4
   9    14    > > RETURN                                                   !1
  10    15*     > RETURN                                                   null

End of function ptr2str

Class obj:
Function __tostring:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 9
Branch analysis from position: 9
Jump found. Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Jump found. Position 1 = -2
Branch analysis from position: 4
Jump found. Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Branch analysis from position: 4
filename:       /in/WY0pB
function name:  __tostring
number of ops:  13
compiled vars:  !0 = $arr, !1 = $i, !2 = $v
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   BIND_GLOBAL                                              !0, 'arr'
  17     1        ASSIGN                                                   !0, 1
  18     2        ASSIGN                                                   !1, 0
         3      > JMP                                                      ->9
  19     4    >   CONCAT                                           ~6      'hi', !1
         5        ASSIGN_DIM                                               !2, !1
         6        OP_DATA                                                  ~6
  18     7        POST_INC                                         ~7      !1
         8        FREE                                                     ~7
         9    >   IS_SMALLER                                       ~8      !1, 5
        10      > JMPNZ                                                    ~8, ->4
  22    11    > > RETURN                                                   'hi'
  23    12*     > RETURN                                                   null

End of function __tostring

End of class obj.

Generated using Vulcan Logic Dumper, using php 7.3.0