3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { echo 'a'; } } $foo = new Foo(); foreach ([['bar']] as $test) { $method = $test[0]; $foo->$method(); // displays "a" ==> success } foreach ([['bar']] as $test) { $foo->{$test[0]}(); // Notice "Array to string conversion" followed by // "Function name must be a string" }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/8tOim
function name:  (null)
number of ops:  19
compiled vars:  !0 = $foo, !1 = $test, !2 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    8     3      > FE_RESET_R                                       $6      <array>, ->10
          4    > > FE_FETCH_R                                               $6, !1, ->10
    9     5    >   FETCH_DIM_R                                      ~7      !1, 0
          6        ASSIGN                                                   !2, ~7
   10     7        INIT_METHOD_CALL                                         !0, !2
          8        DO_FCALL                                      0          
    8     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $6
   14    11      > FE_RESET_R                                       $10     <array>, ->17
         12    > > FE_FETCH_R                                               $10, !1, ->17
   15    13    >   FETCH_DIM_R                                      ~11     !1, 0
         14        INIT_METHOD_CALL                                         !0, ~11
         15        DO_FCALL                                      0          
   14    16      > JMP                                                      ->12
         17    >   FE_FREE                                                  $10
   18    18      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8tOim
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'a'
          1      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.49 ms | 1395 KiB | 13 Q