SyntaxFix
Write A Post
Hire A Developer
Questions
This array_group_by function achieves what you are looking for:
$grouped = array_group_by($arr, 'id');
It even supports multi-level groupings:
$grouped = array_group_by($arr, 'id', 'part_no');