$exist = [1,2,3];
$update = [1,2,4,5,6];
//Action
//1 - Remove no 3
//Add 4,5 and 6
//Both exist before and after
//1,2
$both_exist = array_intersect($exist,$update);
echo ('Check removed');
$removed = array_diff($exist,$both_exist);
echo '';
print_r($removed);
echo '
';
echo ('Added');
$combined = array_unique(array_merge($exist,$update));
$added = array_diff($combined,$exist);
echo '';
print_r($added);
echo '
';
No comments:
Post a Comment