3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sum(float ...$numbers) : float { $intsum = function ($sum, array $numbers) use(&$intsum) { if (count($numbers) == 0) { return $sum; } $number = array_shift($numbers); $sum += $number; return $intsum($sum, $numbers); }; return $intsum(0, $numbers); } echo call_user_func_array('sum', range(1, 8000)); echo PHP_EOL; echo sum(1.5, 2, 3, 4); echo PHP_EOL; try { sum('a', 'b', 'c'); } catch (Error $e) { echo $e->getMessage(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 24
Branch analysis from position: 24
2 jumps found. (Code = 107) Position 1 = 25, Position 2 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V06BL
function name:  (null)
number of ops:  29
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'sum'
          1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 8000
          4        DO_ICALL                                         $1      
          5        SEND_ARRAY                                               $1
          6        CHECK_UNDEF_ARGS                                         
          7        DO_FCALL                                      0  $2      
          8        ECHO                                                     $2
   19     9        ECHO                                                     '%0A'
   20    10        INIT_FCALL                                               'sum'
         11        SEND_VAL                                                 1.5
         12        SEND_VAL                                                 2
         13        SEND_VAL                                                 3
         14        SEND_VAL                                                 4
         15        DO_FCALL                                      0  $3      
         16        ECHO                                                     $3
   21    17        ECHO                                                     '%0A'
   24    18        INIT_FCALL                                               'sum'
         19        SEND_VAL                                                 'a'
         20        SEND_VAL                                                 'b'
         21        SEND_VAL                                                 'c'
         22        DO_FCALL                                      0          
         23      > JMP                                                      ->28
   25    24  E > > CATCH                                       last         'Error'
   26    25    >   INIT_METHOD_CALL                                         !0, 'getMessage'
         26        DO_FCALL                                      0  $5      
         27        ECHO                                                     $5
   27    28    > > RETURN                                                   1

Function sum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V06BL
function name:  sum
number of ops:  12
compiled vars:  !0 = $numbers, !1 = $intsum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_VARIADIC                                    !0      
    5     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FV06BL%3A5%240'
          2        BIND_LEXICAL                                             ~2, !1
          3        ASSIGN                                                   !1, ~2
   15     4        INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAL_EX                                              0
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        VERIFY_RETURN_TYPE                                       $4
          9      > RETURN                                                   $4
   16    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function sum

Function %00%7Bclosure%7D%2Fin%2FV06BL%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V06BL
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $sum, !1 = $numbers, !2 = $intsum, !3 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    7     3        COUNT                                            ~4      !1
          4        IS_EQUAL                                                 ~4, 0
          5      > JMPZ                                                     ~5, ->7
    8     6    > > RETURN                                                   !0
   10     7    >   INIT_FCALL                                               'array_shift'
          8        SEND_REF                                                 !1
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !3, $6
   11    11        ASSIGN_OP                                     1          !0, !3
   12    12        INIT_DYNAMIC_CALL                                        !2
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0  $9      
         16      > RETURN                                                   $9
   13    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FV06BL%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.4 ms | 1403 KiB | 20 Q