3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function method() { echo "Bring me to frond????"; } } class TestParentClass extends A { public function method() { print_r('Parent method'); print "\n"; } } trait TestTrait { public function method() { print_r('Trait method'); print "\n"; } } class TestChildClass extends TestParentClass { use TestTrait { A::method insteadof TestParentClass; /* TestTrait::method as methodAlias; TestParentClass::method insteadof TestTrait; */ } } (new TestChildClass)->method(); (new TestChildClass)->method(); (new TestChildClass)->methodAlias();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNB49
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   DECLARE_CLASS                                            'testchildclass', 'testparentclass'
   41     1        NEW                                              $0      'TestChildClass'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'method'
          4        DO_FCALL                                      0          
   42     5        NEW                                              $3      'TestChildClass'
          6        DO_FCALL                                      0          
          7        INIT_METHOD_CALL                                         $3, 'method'
          8        DO_FCALL                                      0          
   43     9        NEW                                              $6      'TestChildClass'
         10        DO_FCALL                                      0          
         11        INIT_METHOD_CALL                                         $6, 'methodAlias'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Class A:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNB49
function name:  method
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'Bring+me+to+frond%3F%3F%3F%3F'
    8     1      > RETURN                                                   null

End of function method

End of class A.

Class TestParentClass:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNB49
function name:  method
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'print_r'
          1        SEND_VAL                                                 'Parent+method'
          2        DO_ICALL                                                 
   16     3        ECHO                                                     '%0A'
   17     4      > RETURN                                                   null

End of function method

End of class TestParentClass.

Class TestTrait:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iNB49
function name:  method
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'print_r'
          1        SEND_VAL                                                 'Trait+method'
          2        DO_ICALL                                                 
   25     3        ECHO                                                     '%0A'
   26     4      > RETURN                                                   null

End of function method

End of class TestTrait.

Class TestChildClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143 ms | 1388 KiB | 15 Q