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); $fileName = $rc->getFileName(); print $fileName."\n"; if ('systemlib.php' !== basename($fileName)) { $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/O4BLK
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     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                                                 
   28     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 = 22
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 22
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/O4BLK
function name:  get_declared_user_traits
number of ops:  25
compiled vars:  !0 = $ret, !1 = $v, !2 = $rc, !3 = $fileName
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                                         $5      
          3      > FE_RESET_R                                       $6      $5, ->22
          4    > > FE_FETCH_R                                               $6, !1, ->22
    7     5    >   NEW                                              $7      'ReflectionClass'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $7
    8     9        INIT_METHOD_CALL                                         !2, 'getFileName'
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !3, $10
    9    12        CONCAT                                           ~12     !3, '%0A'
         13        ECHO                                                     ~12
   10    14        INIT_FCALL                                               'basename'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $13     
         17        IS_NOT_IDENTICAL                                         $13, 'systemlib.php'
         18      > JMPZ                                                     ~14, ->21
   11    19    >   ASSIGN_DIM                                               !0
         20        OP_DATA                                                  !1
    5    21    > > JMP                                                      ->4
         22    >   FE_FREE                                                  $6
   14    23      > RETURN                                                   !0
   15    24*     > 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/O4BLK
function name:  this_is_an_interface_method
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     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:
163.51 ms | 1394 KiB | 20 Q