3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class Test {} class Foo { #[Test] public $bar, $baz; } foreach ((new ReflectionClass(Foo::class))->getProperties() as $prop) { var_dump($prop->getAttributes()[0]->newInstance()); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/01Nhv
function name:  (null)
number of ops:  18
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'ReflectionClass'
          1        SEND_VAL_EX                                              'Foo'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $1, 'getProperties'
          4        DO_FCALL                                      0  $3      
          5      > FE_RESET_R                                       $4      $3, ->16
          6    > > FE_FETCH_R                                               $4, !0, ->16
   12     7    >   INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'getAttributes'
          9        DO_FCALL                                      0  $5      
         10        FETCH_DIM_R                                      ~6      $5, 0
         11        INIT_METHOD_CALL                                         ~6, 'newInstance'
         12        DO_FCALL                                      0  $7      
         13        SEND_VAR                                                 $7
         14        DO_ICALL                                                 
   11    15      > JMP                                                      ->6
         16    >   FE_FREE                                                  $4
   13    17      > RETURN                                                   1

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.53 ms | 1080 KiB | 14 Q