I need to merge two arrays of objects into 1 array and remove duplicate email
values.
How can I do that?
These are my sample arrays:
$array1 = [
(object) ["email" => "gffggfg"],
(object) ["email" => "[email protected]"],
(object) ["email" => "wefewf"],
];
$array2 = [
(object) ["email" => "[email protected]"],
(object) ["email" => "wefwef"],
(object) ["email" => "wefewf"],
];
My expected result is:
[
(object) ['email' => 'gffggfg'],
(object) ['email' => '[email protected]'],
(object) ['email' => 'wefewf'],
(object) ['email' => '[email protected]'],
(object) ['email' => 'wefwef'],
]