3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $foo = 'orig'; } $container = ['foo' => new foo()]; function baz ($key){ global $container; return $container[$key]; } $one = baz(); $two = baz(); $one->foo = 'changed'; echo $two->foo;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/moiUO
function name:  (null)
number of ops:  15
compiled vars:  !0 = $container, !1 = $one, !2 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $3      'foo'
          1        DO_FCALL                                      0          
          2        INIT_ARRAY                                       ~5      $3, 'foo'
          3        ASSIGN                                                   !0, ~5
   12     4        INIT_FCALL                                               'baz'
          5        DO_FCALL                                      0  $7      
          6        ASSIGN                                                   !1, $7
   13     7        INIT_FCALL                                               'baz'
          8        DO_FCALL                                      0  $9      
          9        ASSIGN                                                   !2, $9
   14    10        ASSIGN_OBJ                                               !1, 'foo'
         11        OP_DATA                                                  'changed'
   15    12        FETCH_OBJ_R                                      ~12     !2, 'foo'
         13        ECHO                                                     ~12
         14      > RETURN                                                   1

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/moiUO
function name:  baz
number of ops:  5
compiled vars:  !0 = $key, !1 = $container
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        BIND_GLOBAL                                              !1, 'container'
    9     2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function baz

Class foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.93 ms | 1397 KiB | 15 Q