3v4l.org

run code in 500+ PHP versions simultaneously
<?php #[Attribute] class Attr { public function __construct(public int $i) {} } #[Attr(i: 1)] #[NonExistentAttr(somevalue: 'string')] class C {} $refl = new ReflectionClass('C'); $attrs = $refl->getAttributes(); print_r($attrs); print_r($attrs[0]->newInstance()); print_r($attrs[1]->newInstance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5pAHA
function name:  (null)
number of ops:  23
compiled vars:  !0 = $refl, !1 = $attrs
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   NEW                                                  $2      'ReflectionClass'
          1        SEND_VAL_EX                                                  'C'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   13     4        INIT_METHOD_CALL                                             !0, 'getAttributes'
          5        DO_FCALL                                          0  $5      
          6        ASSIGN                                                       !1, $5
   14     7        INIT_FCALL                                                   'print_r'
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                                     
   15    10        INIT_FCALL                                                   'print_r'
         11        FETCH_DIM_R                                          ~8      !1, 0
         12        INIT_METHOD_CALL                                             ~8, 'newInstance'
         13        DO_FCALL                                          0  $9      
         14        SEND_VAR                                                     $9
         15        DO_ICALL                                                     
   16    16        INIT_FCALL                                                   'print_r'
         17        FETCH_DIM_R                                          ~11     !1, 1
         18        INIT_METHOD_CALL                                             ~11, 'newInstance'
         19        DO_FCALL                                          0  $12     
         20        SEND_VAR                                                     $12
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Class Attr:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5pAHA
function name:  __construct
number of ops:  4
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        ASSIGN_OBJ                                                   'i'
          2        OP_DATA                                                      !0
          3      > RETURN                                                       null

End of function __construct

End of class Attr.

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
144.15 ms | 478 KiB | 8 Q