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 ['type' => $type, 'label_id' => $id, 'type' => $result[$type]['type'], 'label_id' => $result[$type]['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 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/1kOBC
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $result, !2 = $type, !3 = $id
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                                           $6      !0, ->19
          3    > > FE_FETCH_R                                                   $6, $7, ->19
          4    >   FETCH_LIST_R                                         $8      $7, 'type'
          5        ASSIGN                                                       !2, $8
          6        FETCH_LIST_R                                         $10     $7, 'label_id'
          7        ASSIGN                                                       !3, $10
          8        FETCH_LIST_R                                         $12     $7, 'type'
          9        FETCH_DIM_W                                          $13     !1, !2
         10        ASSIGN_DIM                                                   $13, 'type'
         11        OP_DATA                                                      $12
         12        FETCH_LIST_R                                         $15     $7, 'label_id'
         13        FETCH_DIM_W                                          $16     !1, !2
         14        FETCH_DIM_W                                          $17     $16, 'label_id'
         15        ASSIGN_DIM                                                   $17
         16        OP_DATA                                                      $15
         17        FREE                                                         $7
         18      > JMP                                                          ->3
         19    >   FE_FREE                                                      $6
   14    20        INIT_FCALL                                                   'var_export'
         21        INIT_FCALL                                                   'array_values'
         22        SEND_VAR                                                     !1
         23        DO_ICALL                                             $19     
         24        SEND_VAR                                                     $19
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.14 ms | 1960 KiB | 15 Q