3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $year = array(2010,2010,2010,2011,2011,2012,2013); $profit = array(100,50,10,80,70,50,40); $sums = array(); for ($i; $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 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 4
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 4
Branch analysis from position: 20
Branch analysis from position: 4
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 4
Branch analysis from position: 20
Branch analysis from position: 4
filename:       /in/O2O7f
function name:  (null)
number of ops:  24
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>
    9     2        ASSIGN                                                   !2, <array>
   11     3      > JMP                                                      ->17
   12     4    >   FETCH_DIM_R                                      ~7      !0, !3
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !2, ~7
          6      > JMPZ                                                     ~8, ->12
   13     7    >   FETCH_DIM_R                                      ~9      !0, !3
          8        FETCH_DIM_R                                      ~11     !1, !3
          9        ASSIGN_DIM_OP                +=               1          !2, ~9
         10        OP_DATA                                                  ~11
         11      > JMP                                                      ->16
   15    12    >   FETCH_DIM_R                                      ~12     !0, !3
         13        FETCH_DIM_R                                      ~14     !1, !3
         14        ASSIGN_DIM                                               !2, ~12
         15        OP_DATA                                                  ~14
   11    16    >   PRE_INC                                                  !3
         17    >   COUNT                                            ~16     !0
         18        IS_SMALLER                                               !3, ~16
         19      > JMPNZ                                                    ~17, ->4
   20    20    >   INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.93 ms | 1395 KiB | 15 Q