3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_declared_user_traits() { $ret = array(); foreach (get_declared_traits() as $v) { // exclude system traits $rc = new ReflectionClass($v); if ('systemlib.php' !== basename($rc->getFileName())) { $ret[] = $v; } } return $ret; } class this_is_a_class { } interface this_is_an_interface { public function this_is_an_interface_method(); } trait this_is_a_trait { } abstract class this_is_an_abstract_class { } final class this_is_a_final_class { } var_dump(get_declared_user_traits()); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dJ0Pd
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'get_declared_user_traits'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   26     5      > RETURN                                                   1

Function get_declared_user_traits:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/dJ0Pd
function name:  get_declared_user_traits
number of ops:  22
compiled vars:  !0 = $ret, !1 = $v, !2 = $rc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'get_declared_traits'
          2        DO_ICALL                                         $4      
          3      > FE_RESET_R                                       $5      $4, ->19
          4    > > FE_FETCH_R                                               $5, !1, ->19
    7     5    >   NEW                                              $6      'ReflectionClass'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $6
    8     9        INIT_FCALL                                               'basename'
         10        INIT_METHOD_CALL                                         !2, 'getFileName'
         11        DO_FCALL                                      0  $9      
         12        SEND_VAR                                                 $9
         13        DO_ICALL                                         $10     
         14        IS_NOT_IDENTICAL                                         $10, 'systemlib.php'
         15      > JMPZ                                                     ~11, ->18
    9    16    >   ASSIGN_DIM                                               !0
         17        OP_DATA                                                  !1
    5    18    > > JMP                                                      ->4
         19    >   FE_FREE                                                  $5
   12    20      > RETURN                                                   !0
   13    21*     > RETURN                                                   null

End of function get_declared_user_traits

Class this_is_a_class: [no user functions]
Class this_is_an_interface:
Function this_is_an_interface_method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dJ0Pd
function name:  this_is_an_interface_method
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   null

End of function this_is_an_interface_method

End of class this_is_an_interface.

Class this_is_a_trait: [no user functions]
Class this_is_an_abstract_class: [no user functions]
Class this_is_a_final_class: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.48 ms | 1403 KiB | 20 Q