3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<? define ('Foo', 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();
based on HfmDf
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/4tRNH
function name:  (null)
number of ops:  20
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                                                 
   5     4        NOP                                                      
  13     5        NOP                                                      
  21     6        FETCH_CONSTANT                                   ~5      'Foo'
         7        INIT_ARRAY                                       ~6      ~5
         8        FETCH_CONSTANT                                   ~7      'Bar'
         9        ADD_ARRAY_ELEMENT                                ~6      ~7
        10        ASSIGN                                                   !0, ~6
  23    11        FETCH_DIM_R                                      $9      !0, 1
        12        FETCH_CLASS                                 512  :10     $9
        13        NEW                                              $11     :10
        14        DO_FCALL                                      0          
        15        ASSIGN                                                   !1, $11
  24    16        INIT_METHOD_CALL                                         !1, 'foo'
        17        DO_FCALL                                      0  $14     
        18        ECHO                                                     $14
        19      > RETURN                                                   1

Class Foo:
Function foo:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/4tRNH
function name:  foo
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E > > RETURN                                                   'foo'
   9     1*     > RETURN                                                   null

End of function foo

End of class Foo.

Class Bar:
Function foo:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/4tRNH
function name:  foo
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  16     0  E > > RETURN                                                   'foo'
  17     1*     > RETURN                                                   null

End of function foo

End of class Bar.

Generated using Vulcan Logic Dumper, using php 7.3.0