最佳答案
我需要将两个对象数组合并为一个数组,并删除重复的 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'],
]