3v4l.org

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

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

End of function sum

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

End of function %00%7Bclosure%7D%2Fin%2Fue9ER%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.54 ms | 1403 KiB | 18 Q