合并两个包含对象的数组并删除重复值
我需要将两个对象数组合并为1个数组并删除重复值。email
我该怎么做?
这些是我的示例数组:
$array1 = [
(object) ["email" => "gffggfg"],
(object) ["email" => "wefwef@test.it"],
(object) ["email" => "wefewf"],
];
$array2 = [
(object) ["email" => "gffggfg@test.it"],
(object) ["email" => "wefwef"],
(object) ["email" => "wefewf"],
];
我的预期结果是:
[
(object) ['email' => 'gffggfg'],
(object) ['email' => 'wefwef@test.it'],
(object) ['email' => 'wefewf'],
(object) ['email' => 'gffggfg@test.it'],
(object) ['email' => 'wefwef'],
]