3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $bar = ['foo' => 1, 'bar' => 2]; public static function baz ($name) { return self::$bar[$name]; } } $item = ['name' => 'bar']; $baz = ['bar' => 'baz']; echo Foo::$bar[$item['name']]; echo Foo::$baz[$item['name']];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eg7UZ
function name:  (null)
number of ops:  11
compiled vars:  !0 = $item, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
    9     2        FETCH_DIM_R                                      ~5      !0, 'name'
          3        FETCH_STATIC_PROP_R          unknown             ~4      'bar'
          4        FETCH_DIM_R                                      ~6      ~4, ~5
          5        ECHO                                                     ~6
   10     6        FETCH_DIM_R                                      ~8      !0, 'name'
          7        FETCH_STATIC_PROP_R          unknown             ~7      'baz'
          8        FETCH_DIM_R                                      ~9      ~7, ~8
          9        ECHO                                                     ~9
         10      > RETURN                                                   1

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

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.37 ms | 1393 KiB | 13 Q