📅  最后修改于: 2022-03-11 14:53:50.557000             🧑  作者: Mango
function array_group(array $data, $by_column) {
$result = [];
foreach ($data as $item) {
$column = $item[$by_column];
unset($item[$by_column]);
if (isset($result[$column])) {
$result[$column][] = $item;
} else {
$result[$column] = array($item);
}
}
return $result;
}
$result = array_group($assocArray,'name');