3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "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 ($array as $row) { $key = $row['id']; // assign the grouping column's value // unset($row['id']); // if you don't want grouping column in your grouped rows, remove it if (!isset($ref[$key])) { $result[] =& $ref[$key]; } $ref[$key][] = $row; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/fCfD8
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $key, !4 = $ref
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                                       $7      !0, ->17
          3    > > FE_FETCH_R                                               $7, !2, ->17
   29     4    >   FETCH_DIM_R                                      ~8      !2, 'id'
          5        ASSIGN                                                   !3, ~8
   31     6        ISSET_ISEMPTY_DIM_OBJ                         0  ~10     !4, !3
          7        BOOL_NOT                                         ~11     ~10
          8      > JMPZ                                                     ~11, ->13
   32     9    >   FETCH_DIM_W                                      $13     !4, !3
         10        MAKE_REF                                         $14     $13
         11        FETCH_DIM_W                                      $12     !1
         12        ASSIGN_REF                                               $12, $14
   34    13    >   FETCH_DIM_W                                      $16     !4, !3
         14        ASSIGN_DIM                                               $16
         15        OP_DATA                                                  !2
   28    16      > JMP                                                      ->3
         17    >   FE_FREE                                                  $7
   36    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.7 ms | 1010 KiB | 14 Q