3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T1 { public static function m(){ echo "t1 trait"; } } trait T2 { public static function m(){ echo "t2 trait"; } } class Test { use T1, T2; public function __construct() { var_dump((new ReflectionClass($this))->getTraitNames()); } } $t = new Test();
based on OXq6E
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bVpbb
function name:  (null)
number of ops:  10
compiled vars:  !0 = $t
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  11     1        NOP                                                      
  19     2        DECLARE_CLASS                                    $3      'test'
  21     3        ADD_TRAIT                                                $3, 'T1'
         4        ADD_TRAIT                                                $3, 'T2'
  19     5        BIND_TRAITS                                              $3
  29     6        NEW                                              $4      :1
         7        DO_FCALL                                      0          
         8        ASSIGN                                                   !0, $4
         9      > RETURN                                                   1

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

End of function m

End of class T1.

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

End of function m

End of class T2.

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bVpbb
function name:  __construct
number of ops:  10
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  24     0  E >   INIT_FCALL                                               'var_dump'
         1        NEW                                              $0      :-4
         2        FETCH_THIS                                       $1      
         3        SEND_VAR_EX                                              $1
         4        DO_FCALL                                      0          
         5        INIT_METHOD_CALL                                         $0, 'getTraitNames'
         6        DO_FCALL                                      0  $3      
         7        SEND_VAR                                                 $3
         8        DO_ICALL                                                 
  25     9      > RETURN                                                   null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 7.3.0