Creating one array from another array in php [closed]

Use below code:-

$result = [];
foreach($MainArray as $record){
 $result[$record['Machine_Name']][] = $record;
}