3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_PROPERTY)] enum Types { case Int32; case Int64; case Float32; } define('Float32', Types::Float32); define('Int64', Types::Int64); define('Int32', Types::Int32); class Test { #[Int32] #[Blah] public int $value; } $t = new Test(); $r = new ReflectionClass($t); $attr = $r->getProperty('value')->getAttributes(); foreach($attr as &$a) { if (class_exists($a->getName())) { $a = $a->newInstance(); } else if(defined($a->getName())) { $a = constant($a->getName()); } } var_dump($attr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 30, Position 2 = 54
Branch analysis from position: 30
2 jumps found. (Code = 126) Position 1 = 31, Position 2 = 54
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 53
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 53
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
filename:       /in/Vcl37
function name:  (null)
number of ops:  59
compiled vars:  !0 = $t, !1 = $r, !2 = $attr, !3 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'types'
   11     1        INIT_FCALL                                               'define'
          2        SEND_VAL                                                 'Float32'
          3        FETCH_CLASS_CONSTANT                             ~4      'Types', 'Float32'
          4        SEND_VAL                                                 ~4
          5        DO_ICALL                                                 
   12     6        INIT_FCALL                                               'define'
          7        SEND_VAL                                                 'Int64'
          8        FETCH_CLASS_CONSTANT                             ~6      'Types', 'Int64'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
   13    11        INIT_FCALL                                               'define'
         12        SEND_VAL                                                 'Int32'
         13        FETCH_CLASS_CONSTANT                             ~8      'Types', 'Int32'
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                                 
   21    16        NEW                                              $10     'Test'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !0, $10
   22    19        NEW                                              $13     'ReflectionClass'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !1, $13
   23    23        INIT_METHOD_CALL                                         !1, 'getProperty'
         24        SEND_VAL_EX                                              'value'
         25        DO_FCALL                                      0  $16     
         26        INIT_METHOD_CALL                                         $16, 'getAttributes'
         27        DO_FCALL                                      0  $17     
         28        ASSIGN                                                   !2, $17
   24    29      > FE_RESET_RW                                      $19     !2, ->54
         30    > > FE_FETCH_RW                                              $19, !3, ->54
   25    31    >   INIT_FCALL                                               'class_exists'
         32        INIT_METHOD_CALL                                         !3, 'getName'
         33        DO_FCALL                                      0  $20     
         34        SEND_VAR                                                 $20
         35        DO_ICALL                                         $21     
         36      > JMPZ                                                     $21, ->41
   26    37    >   INIT_METHOD_CALL                                         !3, 'newInstance'
         38        DO_FCALL                                      0  $22     
         39        ASSIGN                                                   !3, $22
   25    40      > JMP                                                      ->53
   27    41    >   INIT_FCALL                                               'defined'
         42        INIT_METHOD_CALL                                         !3, 'getName'
         43        DO_FCALL                                      0  $24     
         44        SEND_VAR                                                 $24
         45        DO_ICALL                                         $25     
         46      > JMPZ                                                     $25, ->53
   28    47    >   INIT_FCALL                                               'constant'
         48        INIT_METHOD_CALL                                         !3, 'getName'
         49        DO_FCALL                                      0  $26     
         50        SEND_VAR                                                 $26
         51        DO_ICALL                                         $27     
         52        ASSIGN                                                   !3, $27
   24    53    > > JMP                                                      ->30
         54    >   FE_FREE                                                  $19
   31    55        INIT_FCALL                                               'var_dump'
         56        SEND_VAR                                                 !2
         57        DO_ICALL                                                 
         58      > RETURN                                                   1

Class Types: [no user functions]
Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.76 ms | 1014 KiB | 18 Q