3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ [ 'id' => 96, 'shipping_no' => 212755-1, 'part_no' => 'reterty', 'description' => 'tyrfyt', 'packaging_type' => 'PC' ], [ 'id' => 96, 'shipping_no' => 212755-1, 'part_no' => 'dftgtryh', 'description' => 'dfhgfyh', 'packaging_type' => 'PC' ], [ 'id' => 97, 'shipping_no' => 212755-2, 'part_no' => 'ZeoDark', 'description' => 's%c%s%c%s', 'packaging_type' => 'PC' ] ]; $result = []; foreach ($input as $row) { $id = $row['id']; unset($row['id']); if (isset($result[$id])) { $result[$id]['value'][] = $row; } else { $result[$id] = [ 'key' => $id, 'value' => [$row] ]; } } var_export( array_values($result) );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/QAIG3
function name:  (null)
number of ops:  28
compiled vars:  !0 = $input, !1 = $result, !2 = $row, !3 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   27     1        ASSIGN                                                   !1, <array>
   28     2      > FE_RESET_R                                       $6      !0, ->20
          3    > > FE_FETCH_R                                               $6, !2, ->20
   29     4    >   FETCH_DIM_R                                      ~7      !2, 'id'
          5        ASSIGN                                                   !3, ~7
   30     6        UNSET_DIM                                                !2, 'id'
   31     7        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !3
          8      > JMPZ                                                     ~9, ->14
   32     9    >   FETCH_DIM_W                                      $10     !1, !3
         10        FETCH_DIM_W                                      $11     $10, 'value'
         11        ASSIGN_DIM                                               $11
         12        OP_DATA                                                  !2
   31    13      > JMP                                                      ->19
   35    14    >   INIT_ARRAY                                       ~14     !3, 'key'
   36    15        INIT_ARRAY                                       ~15     !2
         16        ADD_ARRAY_ELEMENT                                ~14     ~15, 'value'
   34    17        ASSIGN_DIM                                               !1, !3
   36    18        OP_DATA                                                  ~14
   28    19    > > JMP                                                      ->3
         20    >   FE_FREE                                                  $6
   40    21        INIT_FCALL                                               'var_export'
   41    22        INIT_FCALL                                               'array_values'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $16     
         25        SEND_VAR                                                 $16
   40    26        DO_ICALL                                                 
   42    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.15 ms | 1007 KiB | 15 Q