現在、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)