3v4l.org

run code in 300+ PHP versions simultaneously
<?php $func = function($one, $two = 'test') { echo 'test function ran'.PHP_EOL; }; $info = new ReflectionFunction($func); var_dump( $info->getName(), $info->getNumberOfParameters(), $info->getNumberOfRequiredParameters() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Oq1k7
function name:  (null)
number of ops:  18
compiled vars:  !0 = $func, !1 = $info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOq1k7%3A3%240'
          1        ASSIGN                                                   !0, ~2
    6     2        NEW                                              $4      'ReflectionFunction'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
    7     6        INIT_FCALL                                               'var_dump'
    8     7        INIT_METHOD_CALL                                         !1, 'getName'
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR                                                 $7
    9    10        INIT_METHOD_CALL                                         !1, 'getNumberOfParameters'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
   10    13        INIT_METHOD_CALL                                         !1, 'getNumberOfRequiredParameters'
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                                 
   11    17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FOq1k7%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Oq1k7
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $one, !1 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'test'
    4     2        ECHO                                                     'test+function+ran%0A'
    5     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOq1k7%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.73 ms | 1395 KiB | 15 Q