3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_METHOD)] class A { } class B { #[A] public function m() { } } $a = new B(); $c = [$a, 'm']; $r = new ReflectionFunction($c(...)); var_dump($r->getAttributes()[0]->newInstance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fepGP
function name:  (null)
number of ops:  21
compiled vars:  !0 = $a, !1 = $c, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $3      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   17     3        INIT_ARRAY                                       ~6      !0
          4        ADD_ARRAY_ELEMENT                                ~6      'm'
          5        ASSIGN                                                   !1, ~6
   18     6        NEW                                              $8      'ReflectionFunction'
          7        INIT_DYNAMIC_CALL                                        !1
          8        ZEND_CALLABLE_CONVERT                            ~9      
          9        SEND_VAL_EX                                              ~9
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $8
   19    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !2, 'getAttributes'
         14        DO_FCALL                                      0  $12     
         15        FETCH_DIM_R                                      ~13     $12, 0
         16        INIT_METHOD_CALL                                         ~13, 'newInstance'
         17        DO_FCALL                                      0  $14     
         18        SEND_VAR                                                 $14
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class A: [no user functions]
Class B:
Function m:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fepGP
function name:  m
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   null

End of function m

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138 ms | 997 KiB | 14 Q