3v4l.org

run code in 500+ PHP versions simultaneously
<?php #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class HookWithDependency { public function __construct( public readonly string $name, public readonly ?string $type = 'module', ) { } } #[HookWithDependency(name: 'bar')] class Example {} $reflectionClass = new \ReflectionClass(Example::class); var_dump($reflectionClass->getAttributes()[0]->newInstance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/egZQ2
function name:  (null)
number of ops:  13
compiled vars:  !0 = $reflectionClass
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $1      'ReflectionClass'
          1        SEND_VAL_EX                                                  'Example'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   20     4        INIT_FCALL                                                   'var_dump'
          5        INIT_METHOD_CALL                                             !0, 'getAttributes'
          6        DO_FCALL                                          0  $4      
          7        FETCH_DIM_R                                          ~5      $4, 0
          8        INIT_METHOD_CALL                                             ~5, 'newInstance'
          9        DO_FCALL                                          0  $6      
         10        SEND_VAR                                                     $6
         11        DO_ICALL                                                     
         12      > RETURN                                                       1

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

End of function __construct

End of class HookWithDependency.

Class Example: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.61 ms | 1452 KiB | 14 Q