3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function createBaz() { return new Baz(); } public function __construct() { var_dump('Base class constructor'); } } trait Bar { public function __construct() { var_dump('Trait constructor'); parent::__construct(); } } class Baz extends Foo { use Bar; } Foo::createBaz();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sIKqQ
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   DECLARE_CLASS                                            'baz', 'foo'
   30     1        INIT_STATIC_METHOD_CALL                                  'Foo', 'createBaz'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

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

End of function createbaz

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sIKqQ
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'Base+class+constructor'
          2        DO_ICALL                                                 
   13     3      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sIKqQ
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'Trait+constructor'
          2        DO_ICALL                                                 
   21     3        INIT_STATIC_METHOD_CALL                                  
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function __construct

End of class Bar.

Class Baz: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.17 ms | 1396 KiB | 15 Q