3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $foo = 'orig'; } $container = array('foo' => new foo()); function load_class ($key){ global $container; return $container[$key]; } $one = load_class('foo'); $two = load_class('foo'); $one->foo = 'changed'; echo $two->foo;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zlc5b
function name:  (null)
number of ops:  17
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                                               'load_class'
          5        SEND_VAL                                                 'foo'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !1, $7
   13     8        INIT_FCALL                                               'load_class'
          9        SEND_VAL                                                 'foo'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
   14    12        ASSIGN_OBJ                                               !1, 'foo'
         13        OP_DATA                                                  'changed'
   15    14        FETCH_OBJ_R                                      ~12     !2, 'foo'
         15        ECHO                                                     ~12
         16      > RETURN                                                   1

Function load_class:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zlc5b
function name:  load_class
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 load_class

Class foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.72 ms | 1398 KiB | 15 Q