What is the best way to remove any duplicate rows from my output based on the e-mail address field?
I have tried using array_unique
however it removed far too many e-mails.
Output Array:
$guestOutput[] = [
'firstName' => $guest->guestFirstName,
'lastName' => $guest->guestLastName,
'email' => $guest->guestEmail,
];
Array Example:
[0]=>
array(3) {
["firstName"]=>
string(5) "T"
["lastName"]=>
string(6) "B"
["email"]=>
string(21) "glh@gmail.com"
}
[1]=>
array(3) {
["firstName"]=>
string(5) "L"
["lastName"]=>
string(7) "Kr"
["email"]=>
string(23) "email1@gmail.com"
}
My end goal is that I am creating a CSV file :)