3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T1 { abstract protected function _doStuff(); } trait T2 { protected function _doStuff() { echo "Doing stuff in trait\n"; } } class C { use T1 { _doStuff as _traitDoStuff; } use T2 { _doStuff as _traitDoStuff; } protected function _doStuff() { echo "Doing stuff in class\n"; $this->_traitDoStuff(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HKC2p
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_CLASS                                            'c'
   32     1      > RETURN                                                   1

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

End of function _dostuff

End of class T1.

Class T2:
Function _dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HKC2p
function name:  _doStuff
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'Doing+stuff+in+trait%0A'
   13     1      > RETURN                                                   null

End of function _dostuff

End of class T2.

Class C:
Function _dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HKC2p
function name:  _doStuff
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'Doing+stuff+in+class%0A'
   30     1        INIT_METHOD_CALL                                         '_traitDoStuff'
          2        DO_FCALL                                      0          
   31     3      > RETURN                                                   null

End of function _dostuff

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.88 ms | 1433 KiB | 13 Q