3v4l.org

run code in 300+ PHP versions simultaneously
<? class Foo { public function foo() { return "foo"; } } class Bar { public function foo() { return "foo"; } } $a = [Foo, Bar]; $b = new $a[1]; echo $b->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HfmDf
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_CONSTANT                                   ~2      'Foo'
          1        INIT_ARRAY                                       ~3      ~2
          2        FETCH_CONSTANT                                   ~4      'Bar'
          3        ADD_ARRAY_ELEMENT                                ~3      ~4
          4        ASSIGN                                                   !0, ~3
   21     5        FETCH_DIM_R                                      ~6      !0, 1
          6        FETCH_CLASS                                   0  $7      ~6
          7        NEW                                              $8      $7
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $8
   22    10        INIT_METHOD_CALL                                         !1, 'foo'
         11        DO_FCALL                                      0  $11     
         12        ECHO                                                     $11
         13      > RETURN                                                   1

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

End of function foo

End of class Foo.

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

End of function foo

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.1 ms | 1385 KiB | 13 Q