3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
246.97 ms | 1005 KiB | 15 Q