3v4l.org

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

Class foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.48 ms | 1394 KiB | 15 Q