3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 0 => '1' , 1 => '2' ], [ 0 => '1' , 1 => '3' ], [ 0 => '2' , 1 => '4' ], [ 0 => '3' , 1 => '3' ], [ 0 => '2' , 1 => '7' ], [ 0 => '1' , 1 => '5' ], [ 0 => '2' , 1 => '6' ] ]; $result = array(); foreach ($array as $row) { if (isset($result[$row[0]])) { $result[$row[0]] += $row[1]; } else { $result[$row[0]] = $row[1]; } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
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
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/C16kU
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $result, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   13     2      > FE_RESET_R                                       $5      !0, ->17
          3    > > FE_FETCH_R                                               $5, !2, ->17
   14     4    >   FETCH_DIM_R                                      ~6      !2, 0
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~6
          6      > JMPZ                                                     ~7, ->12
   15     7    >   FETCH_DIM_R                                      ~8      !2, 0
          8        FETCH_DIM_R                                      ~10     !2, 1
          9        ASSIGN_DIM_OP                +=               1          !1, ~8
         10        OP_DATA                                                  ~10
   14    11      > JMP                                                      ->16
   17    12    >   FETCH_DIM_R                                      ~11     !2, 0
         13        FETCH_DIM_R                                      ~13     !2, 1
         14        ASSIGN_DIM                                               !1, ~11
         15        OP_DATA                                                  ~13
   13    16    > > JMP                                                      ->3
         17    >   FE_FREE                                                  $5
   21    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.62 ms | 1426 KiB | 14 Q