3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $year = array(2011, 2011, 2011, 2012, 2012, 2013, 2013, 2013); $profit = array(23.42, 253.23, 54.5, 433.23, 53.2, 11.4, 45.5, 532.1); $sums = array(); for ($i = 0; $i < count($year); $i++) { if (isset($sums[$year[$i]])) { $sums[$year[$i]] += $profit[$i]; } else { $sums[$year[$i]] = $profit[$i]; } } print_r($sums);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
Branch analysis from position: 5
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
Branch analysis from position: 5
filename:       /in/8rcsp
function name:  (null)
number of ops:  25
compiled vars:  !0 = $year, !1 = $profit, !2 = $sums, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, <array>
   10     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->18
   11     5    >   FETCH_DIM_R                                      ~8      !0, !3
          6        ISSET_ISEMPTY_DIM_OBJ                         0          !2, ~8
          7      > JMPZ                                                     ~9, ->13
   12     8    >   FETCH_DIM_R                                      ~10     !0, !3
          9        FETCH_DIM_R                                      ~12     !1, !3
         10        ASSIGN_DIM_OP                +=               1          !2, ~10
         11        OP_DATA                                                  ~12
         12      > JMP                                                      ->17
   14    13    >   FETCH_DIM_R                                      ~13     !0, !3
         14        FETCH_DIM_R                                      ~15     !1, !3
         15        ASSIGN_DIM                                               !2, ~13
         16        OP_DATA                                                  ~15
   10    17    >   PRE_INC                                                  !3
         18    >   COUNT                                            ~17     !0
         19        IS_SMALLER                                               !3, ~17
         20      > JMPNZ                                                    ~18, ->5
   19    21    >   INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.97 ms | 1396 KiB | 15 Q