PHP effondrer les colonnes communes dans un tableau associatif

/* Collapse on common columns which is also the new key e.g.
([0] => [[id] => 1234, [firstName] => "foo", [1] => [[id] => 1234, [lastName] => "bar")
will become ([1234] => [[firstName] => "foo", [lastName]="bar"]
Credit to https://stackoverflow.com/users/762073/xdazz
*/
$result = array();
foreach ($data as $element) {
    $result[$element['id']][] = $element;// [] appends to the array if it already exists
}
Shy Semicolon