PHP - 将两个数组合并为一个数组(也删除重复项)
2022-08-30 07:08:36
嗨,我正在尝试合并两个数组,并且还想从最终数组中删除重复的值。
这是我的数组 1:
Array
(
[0] => stdClass Object
(
[ID] => 749
[post_author] => 1
[post_date] => 2012-11-20 06:26:07
[post_date_gmt] => 2012-11-20 06:26:07
)
这是我的数组 2:
Array
(
[0] => stdClass Object
(
[ID] => 749
[post_author] => 1
[post_date] => 2012-11-20 06:26:07
[post_date_gmt] => 2012-11-20 06:26:07
)
我用于将两个数组合并为一个数组。它给出这样的输出array_merge
Array
(
[0] => stdClass Object
(
[ID] => 749
[post_author] => 1
[post_date] => 2012-11-20 06:26:07
[post_date_gmt] => 2012-11-20 06:26:07
[1] => stdClass Object
(
[ID] => 749
[post_author] => 1
[post_date] => 2012-11-20 06:26:07
[post_date_gmt] => 2012-11-20 06:26:07
)
我想删除这些重复的条目,或者我可以在合并之前删除这些条目...请帮忙..谢谢!!!!!!!