3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {} #[Foo] class Bar {} $reflection = new ReflectionClass(Bar::class); var_dump( $attr = $reflection->getAttributes(), $attr[0]->getName(), $attr[0]->getTarget(), );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/deu8p
function name:  (null)
number of ops:  19
compiled vars:  !0 = $reflection, !1 = $attr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'ReflectionClass'
          1        SEND_VAL_EX                                              'Bar'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   10     4        INIT_FCALL                                               'var_dump'
   11     5        INIT_METHOD_CALL                                         !0, 'getAttributes'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                           ~6      !1, $5
          8        SEND_VAL                                                 ~6
   12     9        FETCH_DIM_R                                      ~7      !1, 0
         10        INIT_METHOD_CALL                                         ~7, 'getName'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
   13    13        FETCH_DIM_R                                      ~9      !1, 0
         14        INIT_METHOD_CALL                                         ~9, 'getTarget'
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
   10    17        DO_ICALL                                                 
   14    18      > RETURN                                                   1

Class Foo: [no user functions]
Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.54 ms | 953 KiB | 14 Q