3v4l.org

run code in 300+ PHP versions simultaneously
<? define ('Foo', 1); define ('Bar', 1); 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/b37Yn
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'Foo'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                                 
    4     4        INIT_FCALL                                               'define'
          5        SEND_VAL                                                 'Bar'
          6        SEND_VAL                                                 1
          7        DO_ICALL                                                 
   22     8        FETCH_CONSTANT                                   ~4      'Foo'
          9        INIT_ARRAY                                       ~5      ~4
         10        FETCH_CONSTANT                                   ~6      'Bar'
         11        ADD_ARRAY_ELEMENT                                ~5      ~6
         12        ASSIGN                                                   !0, ~5
   24    13        FETCH_DIM_R                                      ~8      !0, 1
         14        FETCH_CLASS                                   0  $9      ~8
         15        NEW                                              $10     $9
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !1, $10
   25    18        INIT_METHOD_CALL                                         !1, 'foo'
         19        DO_FCALL                                      0  $13     
         20        ECHO                                                     $13
         21      > RETURN                                                   1

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

End of function foo

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.38 ms | 1396 KiB | 15 Q