3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = [ [ 'messageId' => '5ACE9D8841', 'sender' => 'john@doe.com' ], [ 'messageId' => '7EE67D8170', 'sender' => 'dan@doe.com' ], [ 'messageId' => '8095FD8836', 'sender' => 'cat@doe.com' ], [ 'messageId' => '7EE67D8170', 'dest' => 'mitch@doe.com', 'status' => 'sent', 'date' => '2021-02-01 11:06:55' ] ]; $result = []; foreach ($myarray as $row) { if (!isset($result[$row['messageId']])) { $result[$row['messageId']] = $row; } else { $result[$row['messageId']] += $row; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
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: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/niWVN
function name:  (null)
number of ops:  24
compiled vars:  !0 = $myarray, !1 = $result, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, <array>
   25     2      > FE_RESET_R                                       $5      !0, ->16
          3    > > FE_FETCH_R                                               $5, !2, ->16
   26     4    >   FETCH_DIM_R                                      ~6      !2, 'messageId'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~7      !1, ~6
          6        BOOL_NOT                                         ~8      ~7
          7      > JMPZ                                                     ~8, ->12
   27     8    >   FETCH_DIM_R                                      ~9      !2, 'messageId'
          9        ASSIGN_DIM                                               !1, ~9
         10        OP_DATA                                                  !2
   26    11      > JMP                                                      ->15
   29    12    >   FETCH_DIM_R                                      ~11     !2, 'messageId'
         13        ASSIGN_DIM_OP                +=               1          !1, ~11
         14        OP_DATA                                                  !2
   25    15    > > JMP                                                      ->3
         16    >   FE_FREE                                                  $5
   32    17        INIT_FCALL                                               'var_export'
         18        INIT_FCALL                                               'array_values'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $13     
         21        SEND_VAR                                                 $13
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.85 ms | 1003 KiB | 15 Q