3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_a = [ ['A', 0, 1047], ['B', 0, 279], ['C', 0, 68], ['D', 0, 4], ]; $array_b = [ ['A', 76, 0], ['B', 170, 0], ['E', 287, 0], ['C', 15, 0], ['D', 210, 0], ]; foreach (array_merge($array_a, $array_b) as $row) { if (!isset($result[$row[0]])) { $result[$row[0]] = $row; } else { $result[$row[0]][1] += $row[1]; $result[$row[0]][2] += $row[2]; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 27
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/VaFHG
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array_a, !1 = $array_b, !2 = $row, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'array_merge'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6      > FE_RESET_R                                       $7      $6, ->27
          7    > > FE_FETCH_R                                               $7, !2, ->27
   20     8    >   FETCH_DIM_R                                      ~8      !2, 0
          9        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !3, ~8
         10        BOOL_NOT                                         ~10     ~9
         11      > JMPZ                                                     ~10, ->16
   21    12    >   FETCH_DIM_R                                      ~11     !2, 0
         13        ASSIGN_DIM                                               !3, ~11
         14        OP_DATA                                                  !2
   20    15      > JMP                                                      ->26
   23    16    >   FETCH_DIM_R                                      ~13     !2, 0
         17        FETCH_DIM_R                                      ~16     !2, 1
         18        FETCH_DIM_RW                                     $14     !3, ~13
         19        ASSIGN_DIM_OP                +=               1          $14, 1
         20        OP_DATA                                                  ~16
   24    21        FETCH_DIM_R                                      ~17     !2, 0
         22        FETCH_DIM_R                                      ~20     !2, 2
         23        FETCH_DIM_RW                                     $18     !3, ~17
         24        ASSIGN_DIM_OP                +=               1          $18, 2
         25        OP_DATA                                                  ~20
   19    26    > > JMP                                                      ->7
         27    >   FE_FREE                                                  $7
   27    28        INIT_FCALL                                               'var_export'
         29        INIT_FCALL                                               'array_values'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $21     
         32        SEND_VAR                                                 $21
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.58 ms | 1003 KiB | 16 Q