我有两个不同的数组,它们有多个值,如下所示,
$a1 = ['a','b','c','sadasd','sadasd','sadasd','sadasd'];
$b1 = ['d','a','c','sadasd'];
$removed = array_diff($a1,$b1);
$added = array_diff($a1,$b1);
现在array_diff
完美无缺,但我面临着多次使用同名值区分的问题
我现在得到的是
$removed =>
Array
(
[1] => b
)
$added =>
Array
(
[0] => d
)
这是array_diff
的原始行为,但是,如何获得像
$removed =>
Array
(
[1] => b
[4] => sadasd
[5] => sadasd
[6] => sadasd
)