3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[\Attribute(\Attribute::TARGET_FUNCTION)] class TaggedLocator{} class User { public function __construct ( #[TaggedLocator] private int $test, ) { } } $r = new ReflectionClass(User::class); var_dump($r->getMethod('__construct')->getParameters()[0]->getAttributes()[0]->getName()); var_dump($r->getProperties());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZB3oi
function name:  (null)
number of ops:  24
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'ReflectionClass'
          1        SEND_VAL_EX                                              'User'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   18     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getMethod'
          6        SEND_VAL_EX                                              '__construct'
          7        DO_FCALL                                      0  $4      
          8        INIT_METHOD_CALL                                         $4, 'getParameters'
          9        DO_FCALL                                      0  $5      
         10        FETCH_DIM_R                                      ~6      $5, 0
         11        INIT_METHOD_CALL                                         ~6, 'getAttributes'
         12        DO_FCALL                                      0  $7      
         13        FETCH_DIM_R                                      ~8      $7, 0
         14        INIT_METHOD_CALL                                         ~8, 'getName'
         15        DO_FCALL                                      0  $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                                 
   20    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !0, 'getProperties'
         20        DO_FCALL                                      0  $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class TaggedLocator: [no user functions]
Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZB3oi
function name:  __construct
number of ops:  4
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'test'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function __construct

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.91 ms | 1011 KiB | 14 Q