I assume that your name field is the unique identifier, but you can modify what fields to compare as you need.
// Original
$multi = array(
array('id'=>1,'name'=>'Frank','desc'=>'BLA BlA'),
array('id'=>2,'name'=>'Mayer','desc'=>'BLA BlA'),
array('id'=>4,'name'=>'Mayer','desc'=>'BLA BlA'),
);
// Final
$final = array();
// Flag
$duplicate = false;
// Step through the original array
for($i = 0; $i < count($multi); $i++) {
// Reset the flag
$duplicate = false;
// Step through the final array
for($x = 0; $x < count($final); $x++) {
// If current multi array has the same value
// As the current final array, then set our flag
// and end the check as there is no longer a need to continue
if($multi[$i]['name'] == $final[$x]['name']) {
$duplicate = true;
$index = $x;
break;
}
}
// If we have a duplicate, add the id to the
// existing index
if($duplicate) {
$final[$index]['id'][] = $multi[$i]['id'];
} else {
// Not a duplicate so just append it to the end of our final array
$final[] = array('id'=>array($multi[$i]['id']),'name'=>$multi[$i]['name'],'desc'=>$multi[$i]['desc']);
}
}
This will spit out what you are looking for. Depending on the size of your arrays and the amount of duplicates, be warned this can become a memory/cpu intensive operation.