3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { static function f() { $php = ' $c = new class () { const U = 21; function f() { return #[A(self::U)] static function () {}; } }; return $c->f(); '; return eval($php); } } $rf = new \ReflectionFunction(C::f()); $ra = $rf->getAttributes()[0]; print $ra->getArguments()[0];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Vea
function name:  (null)
number of ops:  15
compiled vars:  !0 = $rf, !1 = $ra
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'ReflectionFunction'
          1        INIT_STATIC_METHOD_CALL                                  'C', 'f'
          2        DO_FCALL                                      0  $3      
          3        SEND_VAR_NO_REF_EX                                       $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   21     6        INIT_METHOD_CALL                                         !0, 'getAttributes'
          7        DO_FCALL                                      0  $6      
          8        FETCH_DIM_R                                      ~7      $6, 0
          9        ASSIGN                                                   !1, ~7
   22    10        INIT_METHOD_CALL                                         !1, 'getArguments'
         11        DO_FCALL                                      0  $9      
         12        FETCH_DIM_R                                      ~10     $9, 0
         13        ECHO                                                     ~10
         14      > RETURN                                                   1

Class C:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7Vea
function name:  f
number of ops:  4
compiled vars:  !0 = $php
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, '%0A++++++++++++%24c+%3D+new+class+%28%29+%7B%0A++++++++++++++++const+U+%3D+21%3B%0A++++++++++++++++function+f%28%29+%7B%0A++++++++++++++++++++return%0A++++++++++++++++++++++++%23%5BA%28self%3A%3AU%29%5D%0A++++++++++++++++++++++++static+function+%28%29+%7B%7D%3B%0A++++++++++++++++%7D%0A++++++++++++%7D%3B%0A++++++++++++return+%24c-%3Ef%28%29%3B%0A++++++++'
   16     1        INCLUDE_OR_EVAL                                  $2      !0, EVAL
          2      > RETURN                                                   $2
   17     3*     > RETURN                                                   null

End of function f

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.85 ms | 1394 KiB | 13 Q