3v4l.org

run code in 500+ PHP versions simultaneously
<?php function add(int $a, int $b): int { return $a + $b; } $c = Closure::fromCallable('add'); $r = new ReflectionFunction($c); echo $r; $c = fn(...$args) => add(...$args); $r = new ReflectionFunction($c); echo $r;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XBOmJ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $c, !1 = $r
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   INIT_STATIC_METHOD_CALL                                      'Closure', 'fromCallable'
          1        SEND_VAL                                                     'add'
          2        DO_FCALL                                          0  $2      
          3        ASSIGN                                                       !0, $2
    6     4        NEW                                                  $4      'ReflectionFunction'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $4
    7     8        ECHO                                                         !1
    9     9        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
         10        ASSIGN                                                       !0, ~7
   10    11        NEW                                                  $9      'ReflectionFunction'
         12        SEND_VAR_EX                                                  !0
         13        DO_FCALL                                          0          
         14        ASSIGN                                                       !1, $9
   11    15        ECHO                                                         !1
   12    16      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XBOmJ
function name:  {closure:/in/XBOmJ:9}
number of ops:  7
compiled vars:  !0 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV_VARIADIC                                        !0      
          1        INIT_FCALL                                                   'add'
          2        SEND_UNPACK                                                  !0
          3        CHECK_UNDEF_ARGS                                             
          4        DO_FCALL                                          0  $1      
          5      > RETURN                                                       $1
          6*     > RETURN                                                       null

End of Dynamic Function 0

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XBOmJ
function name:  add
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        ADD                                                  ~2      !0, !1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
          5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function add

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.03 ms | 2151 KiB | 14 Q