3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TraitA { protected function doSomething(): string { return 'FOO'; } } trait TraitB { abstract protected function doSomething(): string; } class ParentClass { use TraitB; use TraitA; } class ChildClass extends ParentClass { public function __construct() { echo $this->doSomething(); } } $class = new ChildClass();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lFFsD
function name:  (null)
number of ops:  6
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'parentclass'
   21     1        DECLARE_CLASS                                            'childclass', 'parentclass'
   29     2        NEW                                              $1      'ChildClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
          5      > RETURN                                                   1

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

End of function dosomething

End of class TraitA.

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

End of function dosomething

End of class TraitB.

Class ParentClass: [no user functions]
Class ChildClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lFFsD
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_METHOD_CALL                                         'doSomething'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   26     3      > RETURN                                                   null

End of function __construct

End of class ChildClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.59 ms | 942 KiB | 13 Q