基于多个字段删除多维数组中的重复项

This may be a bit elementary but it's kicking my butt.

I have the follow code:

$newArray = array();
foreach (array_reverse($results) as $val) {
    $newArray[$val['last_name']] = $val;
}
$results = array_values($newArray);

This code successfully removes the duplicates from a multidimensional array based on a persons last name.

The problem exists in the fact that there may be a John Smith and a Susan Smith. I would obviously want to keep both of these entries.

I need some help in being able to remove those duplicates based on couple other pieces of information in addition to the ['last_name'] field; the persons first name ['first_name'] and the event ['event_id'] they signed up for as well.

Any insight would be greatly appreciated. As I said above I know this may be kind of elementary but it has been giving me a headache all day, so any help would be greatly appreciated.

Maybe you can organize the users based on a combination of first and last names or possibly more fields.

$newArray = array();

foreach (array_reverse($results) as $val) {
  $newArray[ $val['last_name'] . ', ' . $newArray[$val['first_name'] ] = $val;
}

$results = array_values($newArray);

This way duplicates could be filtered out while still keeping similar users. You could add the event id in there somewhere as well. This may make searching for a record a little more cumbersome.