3v4l.org

run code in 500+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_CLASS_CONSTANT)] class TestAttribute { public function __construct(public string $value) { } } enum TestNum { #[TestAttribute('alpha value')] case ALPHA; #[TestAttribute('beta value')] case BETA; } var_dump((new \ReflectionClassConstant(TestNum::class, 'ALPHA'))->getAttributes(TestAttribute::class)[0]->newInstance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BsA9r
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                                'testnum'
   20     1        INIT_FCALL                                                   'var_dump'
          2        NEW                                                  $0      'ReflectionClassConstant'
          3        SEND_VAL_EX                                                  'TestNum'
          4        SEND_VAL_EX                                                  'ALPHA'
          5        DO_FCALL                                          0          
          6        INIT_METHOD_CALL                                             $0, 'getAttributes'
          7        SEND_VAL_EX                                                  'TestAttribute'
          8        DO_FCALL                                          0  $2      
          9        FETCH_DIM_R                                          ~3      $2, 0
         10        INIT_METHOD_CALL                                             ~3, 'newInstance'
         11        DO_FCALL                                          0  $4      
         12        SEND_VAR                                                     $4
         13        DO_ICALL                                                     
         14      > RETURN                                                       1

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

End of function __construct

End of class TestAttribute.

Class TestNum: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
185.52 ms | 1569 KiB | 14 Q