3v4l.org

run code in 300+ PHP versions simultaneously
<?php $func = function(array $a, $b){ echo implode(' ', func_get_args()); }; $closure = &$func; $reflection = new ReflectionFunction($closure); $arguments = $reflection->getParameters(); if($arguments && $arguments[0]->isArray()){ echo 'Giving array. Result: '; call_user_func($closure, ['a' => 5, 'b' => 10]); } else { echo 'Giving individuals. Result: '; call_user_func($closure, 5, 10); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/WGmZZ
function name:  (null)
number of ops:  27
compiled vars:  !0 = $func, !1 = $closure, !2 = $reflection, !3 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWGmZZ%3A3%240'
          1        ASSIGN                                                   !0, ~4
    5     2        ASSIGN_REF                                               !1, !0
    6     3        NEW                                              $7      'ReflectionFunction'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $7
    7     7        INIT_METHOD_CALL                                         !2, 'getParameters'
          8        DO_FCALL                                      0  $10     
          9        ASSIGN                                                   !3, $10
    9    10      > JMPZ_EX                                          ~12     !3, ->15
         11    >   FETCH_DIM_R                                      ~13     !3, 0
         12        INIT_METHOD_CALL                                         ~13, 'isArray'
         13        DO_FCALL                                      0  $14     
         14        BOOL                                             ~12     $14
         15    > > JMPZ                                                     ~12, ->21
   10    16    >   ECHO                                                     'Giving+array.+Result%3A+'
   11    17        INIT_USER_CALL                                1          'call_user_func', !1
         18        SEND_USER                                                <array>
         19        DO_FCALL                                      0          
         20      > JMP                                                      ->26
   13    21    >   ECHO                                                     'Giving+individuals.+Result%3A+'
   14    22        INIT_USER_CALL                                2          'call_user_func', !1
         23        SEND_USER                                                5
         24        SEND_USER                                                10
         25        DO_FCALL                                      0          
   15    26    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FWGmZZ%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WGmZZ
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '+'
          4        FUNC_GET_ARGS                                    ~2      
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        ECHO                                                     $3
          8      > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.63 ms | 1400 KiB | 15 Q