3v4l.org

run code in 500+ PHP versions simultaneously
<?php $months = [ '2023-04', '2023-03', '2023-04', '2023-04', '2023-02', ]; $amounts = [ 833, 223, 829, 220, 498 ]; $sums = []; foreach($months as $i => $month) { if (!isset($sums[$month])) { $sums[$month] = 0; } $sums[$month] += $amounts[$i]; } var_dump($sums);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/uItTB
function name:  (null)
number of ops:  20
compiled vars:  !0 = $months, !1 = $amounts, !2 = $sums, !3 = $month, !4 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   11     1        ASSIGN                                                       !1, <array>
   19     2        ASSIGN                                                       !2, <array>
   21     3      > FE_RESET_R                                           $8      !0, ->15
          4    > > FE_FETCH_R                                           ~9      $8, !3, ->15
          5    >   ASSIGN                                                       !4, ~9
   22     6        ISSET_ISEMPTY_DIM_OBJ                             0  ~11     !2, !3
          7        BOOL_NOT                                             ~12     ~11
          8      > JMPZ                                                         ~12, ->11
   23     9    >   ASSIGN_DIM                                                   !2, !3
         10        OP_DATA                                                      0
   26    11    >   FETCH_DIM_R                                          ~15     !1, !4
         12        ASSIGN_DIM_OP                    +=               1          !2, !3
         13        OP_DATA                                                      ~15
   21    14      > JMP                                                          ->4
         15    >   FE_FREE                                                      $8
   29    16        INIT_FCALL                                                   'var_dump'
         17        SEND_VAR                                                     !2
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
190.62 ms | 1722 KiB | 14 Q