如何基于两个数组(在 PHP 中)创建一个新的多维数组,以便合并数组并删除任何重复项。例子:
第一个数组:
Array
(
[0] => Array
(
[id] => 0001
[name] => sample name 1
)
[1] => Array
(
[id] => 0002
[name] => sample name 2
)
[3] => Array
(
[id] => 0003
[name] => sample name 3
)
)
第二个数组:
Array
(
[0] => Array
(
[id] => 0002
[name] => sample name 2
)
[1] => Array
(
[id] => 11323
[name] => blah blah
)
)
所以新数组看起来像这样:
Array
(
[0] => Array
(
[id] => 0001
[name] => sample name 1
)
[1] => Array
(
[id] => 0002
[name] => sample name 2
)
[3] => Array
(
[id] => 0003
[name] => sample name 3
)
[4] => Array
(
[id] => 11323
[name] => blah blah
)
)