3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T1 { public function __construct(){ echo "t1 trait"; parent::__construct(); } } trait T2 { public function __construct(){ echo "t2 trait"; parent::__construct(); } } class Test { use T1, T2; } $t = new Test(); var_dump((new ReflectionClass($t))->getTraitNames());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Ki3f
function name:  (null)
number of ops:  13
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   DECLARE_CLASS                                            'test'
   27     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   28     4        INIT_FCALL                                               'var_dump'
          5        NEW                                              $4      'ReflectionClass'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        INIT_METHOD_CALL                                         $4, 'getTraitNames'
          9        DO_FCALL                                      0  $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class T1:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Ki3f
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     't1+trait'
    7     1        INIT_STATIC_METHOD_CALL                                  
          2        DO_FCALL                                      0          
    8     3      > RETURN                                                   null

End of function __construct

End of class T1.

Class T2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Ki3f
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                     't2+trait'
   16     1        INIT_STATIC_METHOD_CALL                                  
          2        DO_FCALL                                      0          
   17     3      > RETURN                                                   null

End of function __construct

End of class T2.

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.1 ms | 1395 KiB | 15 Q