3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum Status: string { case DRAFT = 'draft'; case PUBLISHED = 'published'; case ARCHIVED = 'archived'; } #[Attribute] class ListensTo { public Status $event; public function __construct(Status $event) { $this->event = $event; } } #[ListensTo(Status::DRAFT)] class TestClass {} print_r((new ReflectionClass(TestClass::class))->getAttributes()[0]->newInstance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BCqrS
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'status'
   25     1        INIT_FCALL                                                   'print_r'
          2        NEW                                                  $0      'ReflectionClass'
          3        SEND_VAL_EX                                                  'TestClass'
          4        DO_FCALL                                          0          
          5        INIT_METHOD_CALL                                             $0, 'getAttributes'
          6        DO_FCALL                                          0  $2      
          7        FETCH_DIM_R                                          ~3      $2, 0
          8        INIT_METHOD_CALL                                             ~3, 'newInstance'
          9        DO_FCALL                                          0  $4      
         10        SEND_VAR                                                     $4
         11        DO_ICALL                                                     
         12      > RETURN                                                       1

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

End of function __construct

End of class ListensTo.

Class TestClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.71 ms | 477 KiB | 8 Q