3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_FUNCTION)] class FunctionAttribute { } class Something { public static function get() { $closure = #[FunctionAttribute] fn() => true; return (new ReflectionFunction($closure)) ->getAttributes(FunctionAttribute::class)[0] ->newInstance(); } } Something::get();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4Gk0
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'Something', 'get'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Class FunctionAttribute: [no user functions]
Class Something:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4Gk0
function name:  get
number of ops:  13
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_LAMBDA_FUNCTION                          ~1      [0]
   12     1        ASSIGN                                                   !0, ~1
   14     2        NEW                                              $3      'ReflectionFunction'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   15     5        INIT_METHOD_CALL                                         $3, 'getAttributes'
          6        SEND_VAL_EX                                              'FunctionAttribute'
          7        DO_FCALL                                      0  $5      
          8        FETCH_DIM_R                                      ~6      $5, 0
   16     9        INIT_METHOD_CALL                                         ~6, 'newInstance'
         10        DO_FCALL                                      0  $7      
         11      > RETURN                                                   $7
   17    12*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4Gk0
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   <true>
          1*     > RETURN                                                   null

End of Dynamic Function 0

End of function get

End of class Something.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
197.87 ms | 1002 KiB | 13 Q