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($ref[$row['messageId']])) { $ref[$row['messageId']] = $row; $result[] = &$ref[$row['messageId']]; } else { $ref[$row['messageId']] += $row; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/ajiLl
function name:  (null)
number of ops:  26
compiled vars:  !0 = $myarray, !1 = $result, !2 = $row, !3 = $ref
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                                       $6      !0, ->21
          3    > > FE_FETCH_R                                               $6, !2, ->21
   26     4    >   FETCH_DIM_R                                      ~7      !2, 'messageId'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !3, ~7
          6        BOOL_NOT                                         ~9      ~8
          7      > JMPZ                                                     ~9, ->17
   27     8    >   FETCH_DIM_R                                      ~10     !2, 'messageId'
          9        ASSIGN_DIM                                               !3, ~10
         10        OP_DATA                                                  !2
   28    11        FETCH_DIM_R                                      ~13     !2, 'messageId'
         12        FETCH_DIM_W                                      $14     !3, ~13
         13        MAKE_REF                                         $15     $14
         14        FETCH_DIM_W                                      $12     !1
         15        ASSIGN_REF                                               $12, $15
   26    16      > JMP                                                      ->20
   30    17    >   FETCH_DIM_R                                      ~17     !2, 'messageId'
         18        ASSIGN_DIM_OP                +=               1          !3, ~17
         19        OP_DATA                                                  !2
   25    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $6
   33    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.42 ms | 1003 KiB | 14 Q