3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.28 ms | 1396 KiB | 15 Q