3v4l.org

run code in 300+ PHP versions simultaneously
<?php class obj { function __tostring() { $GLOBALS['a'] = 'hi'; } } $a = [0, new obj, 2]; $b = ["Nula", "Jedna", "Dva"]; var_dump($a); str_replace($a, $b, "1"); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W51BS
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'obj'
    9     1        INIT_ARRAY                                       ~2      0
          2        NEW                                              $3      'obj'
          3        DO_FCALL                                      0          
          4        ADD_ARRAY_ELEMENT                                ~2      $3
          5        ADD_ARRAY_ELEMENT                                ~2      2
          6        ASSIGN                                                   !0, ~2
   10     7        ASSIGN                                                   !1, <array>
   12     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   13    11        INIT_FCALL                                               'str_replace'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 '1'
         15        DO_ICALL                                                 
   14    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class obj:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W51BS
function name:  __tostring
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_W                      global              $0      'GLOBALS'
          1        ASSIGN_DIM                                               $0, 'a'
          2        OP_DATA                                                  'hi'
    6     3        VERIFY_RETURN_TYPE                                       
          4      > RETURN                                                   null

End of function __tostring

End of class obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.36 ms | 1395 KiB | 17 Q