This is my first array
$old = array(
1,2,3,4,5
);
$new(
2,4,5,6
);
I can do by using foreach command and then compare with two arrays. But the problems is I have to separate with which numbers were newly added and which numbers were removed.
And both array can be changed dynamically
Edit:
I have created a function
function get_diff($old,$new){
$small_arr = $large_arr = array();
if( count($old) > count($new) ){
$small_arr = $new;
$large_arr = $old;
}else{
$small_arr = $old;
$large_arr = $new;
}
$arr = array_diff($large_arr, $small_arr);
return $arr;
}