There is no native one, just use a loop.
$result = array();
foreach ($data as $element) {
$result[$element['id']][] = $element;
}
More Related Contents:
- How to group a multidimensional array by a particular subarray value?
- Group array data on one column and sum data from another column
- Group 2d array rows by one column and sum another column [duplicate]
- Chunk and transpose a flat array into rows with a specific number of columns
- Grouping arrays in PHP
- Group multidimensional array data based on two column values and sum values of one column in each group
- Merge arrays of associative arrays by shared column values
- Merge two indexed arrays of indexed arrays based on first column value
- Group 2d array data using column value to create a 3d array
- Group rows in an associative array of associative arrays by column value and preserve the original first level keys
- Group array values based on key in php? [duplicate]
- Group 2d array data by one column and sum other columns in each group (separately)
- Group array data on one column and sum data from another column to form a flat associative array
- Group 2d array’s row data by one column and sum another column within each group to produce a reduced 2d array
- Merge 2d array rows with same column value and sum another column [duplicate]
- Group rows in a 2d array and count number of rows in each respective group
- How to count the consecutive duplicate values in an array?
- How to Sort a Multi-dimensional Array by Value
- How to get a form input array into a PHP array
- Get the first element of an array
- How to reindex an array?
- How to sort an array of UTF-8 strings?
- Casting an Array with Numeric Keys as an Object
- How to trim white spaces of array values in php
- What’s the difference between array_merge and array + array? [duplicate]
- PHP: do arrays have a maximum size?
- How do I use array_unique on an array of arrays?
- Is there a way to loop through a multidimensional array without knowing it’s depth?
- How to implode array with key and value without foreach in PHP
- Access first level keys with array_map() without calling `array_keys()`