3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a{ public $b=['f'=>'c']; } $a=new a; $b='b'; echo $a->b['f']; // without the $ it works $x = $a->$b; // otherwise you need to assign first echo $x['f']; // now it works echo $a->{$b}['f']; // or wrapped in curlies
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gZJWt
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $b, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $3      'a'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    7     3        ASSIGN                                                   !1, 'b'
    8     4        FETCH_OBJ_R                                      ~7      !0, 'b'
          5        FETCH_DIM_R                                      ~8      ~7, 'f'
          6        ECHO                                                     ~8
    9     7        FETCH_OBJ_R                                      ~9      !0, !1
          8        ASSIGN                                                   !2, ~9
   10     9        FETCH_DIM_R                                      ~11     !2, 'f'
         10        ECHO                                                     ~11
   11    11        FETCH_OBJ_R                                      ~12     !0, !1
         12        FETCH_DIM_R                                      ~13     ~12, 'f'
         13        ECHO                                                     ~13
         14      > RETURN                                                   1

Class a: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.19 ms | 1006 KiB | 13 Q