3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Trait1 { public function init() { echo("Trait1 - init\n"); } } trait Trait2 { public function init() { echo("Trait2 - init\n"); } } class Test { use Trait1 { init as private method1trait1; } use Trait2 { init as public method1trait2; } final public function __construct() { $this->init(); $this->method1trait1(); $this->method1trait2(); } public function init() { echo("Test - init\n"); } } $test = new Test(); $reflection = new ReflectionClass( $test ); foreach($reflection->getTraitAliases() as $k => $v) { echo $k.' => '.$v."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/bbc88
function name:  (null)
number of ops:  20
compiled vars:  !0 = $test, !1 = $reflection, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   DECLARE_CLASS                                            'test'
   44     1        NEW                                              $4      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   46     4        NEW                                              $7      'ReflectionClass'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   48     8        INIT_METHOD_CALL                                         !1, 'getTraitAliases'
          9        DO_FCALL                                      0  $10     
         10      > FE_RESET_R                                       $11     $10, ->18
         11    > > FE_FETCH_R                                       ~12     $11, !2, ->18
         12    >   ASSIGN                                                   !3, ~12
   50    13        CONCAT                                           ~14     !3, '+%3D%3E+'
         14        CONCAT                                           ~15     ~14, !2
         15        CONCAT                                           ~16     ~15, '%0A'
         16        ECHO                                                     ~16
   48    17      > JMP                                                      ->11
         18    >   FE_FREE                                                  $11
   51    19      > RETURN                                                   1

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

End of function init

End of class Trait1.

Class Trait2:
Function init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bbc88
function name:  init
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ECHO                                                     'Trait2+-+init%0A'
   17     1      > RETURN                                                   null

End of function init

End of class Trait2.

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bbc88
function name:  __construct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_METHOD_CALL                                         'init'
          1        DO_FCALL                                      0          
   34     2        INIT_METHOD_CALL                                         'method1trait1'
          3        DO_FCALL                                      0          
   35     4        INIT_METHOD_CALL                                         'method1trait2'
          5        DO_FCALL                                      0          
   36     6      > RETURN                                                   null

End of function __construct

Function init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bbc88
function name:  init
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   ECHO                                                     'Test+-+init%0A'
   41     1      > RETURN                                                   null

End of function init

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.16 ms | 1399 KiB | 13 Q