我现在有 2 个数组,我怎样才能得到 2 个数组之间的区别?
foreach($test1 as $array)
{
if (!isset($result[$array["id"]])) $result[$array["id"]] = $array["date"];
}
foreach ($result as $id => $date) {
$new1[] = array("id" => $id, "date" => $date);
}
给我这个输出:
Array ( [0] => Array ( [id] => 47523 [date] => 11-02-13 05:36:32 ) [1] => Array ( [id] => 42415 [date] => 12-02-13 13:56:48 )
_
foreach($test2 as $array) {
if (!isset($result[$array["id"]])) $result[$array["id"]] = $array["date"];
}
foreach ($result as $id => $date) {
$new2[] = array("id" => $id, "date" => $date);
}
给我这个输出:
Array ( [0] => Array ( [id] => 47523 [date] => 12-02-13 14:22:14 ) [1] => Array ( [id] => 42135[date] => 02-02-13 14:51:42 )
现在我想比较它们,以便找出差异:我希望预期的输出如下:
Array ( [0] => Array ( [id] => 42415 [date] => 12-02-13 13:56:48 ) [1] => Array ( [id] => 42135[date] => 02-02-13 14:51:42)