3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Thing{ public function doSomething(){ echo 'I will do it'; } } class TestA{ use Thing{ Thing::doSomething as doit; } } $objTestA = new TestA(); $objTestA->doit(); $objTestA->doSomething(); // also WORKS
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n9WVH
function name:  (null)
number of ops:  9
compiled vars:  !0 = $objTestA
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                                'testa'
   11     1        NEW                                                  $1      'TestA'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   12     4        INIT_METHOD_CALL                                             !0, 'doit'
          5        DO_FCALL                                          0          
   13     6        INIT_METHOD_CALL                                             !0, 'doSomething'
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Class Thing:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n9WVH
function name:  doSomething
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                         'I+will+do+it'
          1      > RETURN                                                       null

End of function dosomething

End of class Thing.

Class TestA: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.59 ms | 3324 KiB | 13 Q