3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['date' => '2017-08-22', 'AAA' => 1231], ['date' => '2017-08-21', 'AAA' => 1172], ['date' => '2017-08-20', 'AAA' => 1125], ['date' => '2017-08-21', 'BBB' => 251], ['date' => '2017-08-20', 'BBB' => 21773], ['date' => '2017-08-22', 'CCC' => 3750], ['date' => '2017-08-20', 'CCC' => 321750], ]; foreach ($array as $row) { $date = $row['date']; unset($row['date']); $result[$date] = array_merge($result[$date] ?? [], $row); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 16
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/XVBZm
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $row, !2 = $date, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1      > FE_RESET_R                                       $5      !0, ->16
          2    > > FE_FETCH_R                                               $5, !1, ->16
   14     3    >   FETCH_DIM_R                                      ~6      !1, 'date'
          4        ASSIGN                                                   !2, ~6
   15     5        UNSET_DIM                                                !1, 'date'
   16     6        INIT_FCALL                                               'array_merge'
          7        FETCH_DIM_IS                                     ~9      !3, !2
          8        COALESCE                                         ~10     ~9
          9        QM_ASSIGN                                        ~10     <array>
         10        SEND_VAL                                                 ~10
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $11     
         13        ASSIGN_DIM                                               !3, !2
         14        OP_DATA                                                  $11
   13    15      > JMP                                                      ->2
         16    >   FE_FREE                                                  $5
   18    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.72 ms | 1002 KiB | 15 Q