3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class A {} class B {} #[A] function a(): void {} #[B] function b(): void {} $a = new ReflectionFunction('a'); $b = new ReflectionFunction('b'); foreach([$a, $b] as $reflection) { $attributes = $reflection->getAttributes(); foreach ($attributes as $attribute) { var_dump($attribute->getName()); var_dump($attribute->getArguments()); var_dump($attribute->newInstance()); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 35
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 35
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 33
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 33
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 33
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/QGQRF
function name:  (null)
number of ops:  37
compiled vars:  !0 = $a, !1 = $b, !2 = $reflection, !3 = $attributes, !4 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $5      'ReflectionFunction'
          1        SEND_VAL_EX                                              'a'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
   16     4        NEW                                              $8      'ReflectionFunction'
          5        SEND_VAL_EX                                              'b'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
   17     8        INIT_ARRAY                                       ~11     !0
          9        ADD_ARRAY_ELEMENT                                ~11     !1
         10      > FE_RESET_R                                       $12     ~11, ->35
         11    > > FE_FETCH_R                                               $12, !2, ->35
   18    12    >   INIT_METHOD_CALL                                         !2, 'getAttributes'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !3, $13
   20    15      > FE_RESET_R                                       $15     !3, ->33
         16    > > FE_FETCH_R                                               $15, !4, ->33
   21    17    >   INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !4, 'getName'
         19        DO_FCALL                                      0  $16     
         20        SEND_VAR                                                 $16
         21        DO_ICALL                                                 
   22    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !4, 'getArguments'
         24        DO_FCALL                                      0  $18     
         25        SEND_VAR                                                 $18
         26        DO_ICALL                                                 
   23    27        INIT_FCALL                                               'var_dump'
         28        INIT_METHOD_CALL                                         !4, 'newInstance'
         29        DO_FCALL                                      0  $20     
         30        SEND_VAR                                                 $20
         31        DO_ICALL                                                 
   20    32      > JMP                                                      ->16
         33    >   FE_FREE                                                  $15
   17    34      > JMP                                                      ->11
         35    >   FE_FREE                                                  $12
   25    36      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QGQRF
function name:  a
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QGQRF
function name:  b
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   null

End of function b

Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.96 ms | 1002 KiB | 14 Q