3v4l.org

run code in 300+ PHP versions simultaneously
<?php class T1Handler { public static function m(){ echo "t1 trait"; } } class T2Handler { public static function m(){ echo "t2 trait"; } } trait T1 { } trait T2 { } class Test { use T1, T2; public function __construct() { $traits = (new ReflectionClass($this))->getTraitNames(); foreach ($traits as $trait) { $trait::m(); } } } $t = new Test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtcMA
function name:  (null)
number of ops:  5
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   DECLARE_CLASS                                            'test'
   44     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

Class T1Handler:
Function m:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtcMA
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 T1Handler.

Class T2Handler:
Function m:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtcMA
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 T2Handler.

Class T1: [no user functions]
Class T2: [no user functions]
Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/gtcMA
function name:  __construct
number of ops:  15
compiled vars:  !0 = $traits, !1 = $trait
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $2      'ReflectionClass'
          1        FETCH_THIS                                       $3      
          2        SEND_VAR_EX                                              $3
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $2, 'getTraitNames'
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !0, $5
   36     7      > FE_RESET_R                                       $7      !0, ->13
          8    > > FE_FETCH_R                                               $7, !1, ->13
   37     9    >   FETCH_CLASS                                   0  $8      !1
         10        INIT_STATIC_METHOD_CALL                                  $8, 'm'
         11        DO_FCALL                                      0          
   36    12      > JMP                                                      ->8
         13    >   FE_FREE                                                  $7
   40    14      > RETURN                                                   null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.15 ms | 1395 KiB | 13 Q