3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ ['type' => 'AAA', 'label_id' => 'A1,35'], ['type' => 'AAA', 'label_id' => 'A2,34'], ['type' => 'BBB', 'label_id' => 'B1,29'], ['type' => 'CCC', 'label_id' => 'C1,20'], ['type' => 'CCC', 'label_id' => 'C2,19'], ['type' => 'CCC', 'label_id' => 'C3,18'] ]; $result = []; foreach ($array as $row) { $result[$row['type']]['type'] ??= $row['type']; $result[$row['type']]['label_id'][] = $row['label_id']; } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/v3kPW
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array, !1 = $result, !2 = $row
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   12     1        ASSIGN                                                       !1, <array>
   13     2      > FE_RESET_R                                           $5      !0, ->24
          3    > > FE_FETCH_R                                                   $5, !2, ->24
   14     4    >   FETCH_DIM_R                                          ~6      !2, 'type'
          5        COPY_TMP                                             ~7      ~6
          6        FETCH_DIM_IS                                         ~8      !1, ~6
          7        FETCH_DIM_IS                                         ~9      ~8, 'type'
          8        COALESCE                                             ~10     ~9
          9        FETCH_DIM_R                                          ~11     !2, 'type'
         10        FETCH_DIM_W                                          $12     !1, ~7
         11        ASSIGN_DIM                                           ~13     $12, 'type'
         12        OP_DATA                                                      ~11
         13        QM_ASSIGN                                            ~10     ~13
         14      > JMP                                                          ->16
         15*       FREE                                                         ~7
         16    >   FREE                                                         ~10
   15    17        FETCH_DIM_R                                          ~14     !2, 'type'
         18        FETCH_DIM_R                                          ~18     !2, 'label_id'
         19        FETCH_DIM_W                                          $15     !1, ~14
         20        FETCH_DIM_W                                          $16     $15, 'label_id'
         21        ASSIGN_DIM                                                   $16
         22        OP_DATA                                                      ~18
   13    23      > JMP                                                          ->3
         24    >   FE_FREE                                                      $5
   17    25        INIT_FCALL                                                   'var_export'
         26        INIT_FCALL                                                   'array_values'
         27        SEND_VAR                                                     !1
         28        DO_ICALL                                             $19     
         29        SEND_VAR                                                     $19
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.06 ms | 1960 KiB | 15 Q