array_diff and array_intersect
array_diff()
This function is used to find the difference between two arrays. This function gets two arguments, both arguments should be an array.And it returns an array that will contain all the values of argument1 which are not in argument2.
For example
$arr1 = array(1,2,3,4,5);
$arr2 = array(0,3,4,5,6);
$temp = array_diff($arr1,$arr2);
print_r($temp);
Now $temp array will contain (1,2)
array_intersect
This function is used to find the common elements between two arrays.This function gets two arguments, both arguments should be an array.And it returns an array which will contain all the common elements in 2 arguments
For example
$arr1 = array(1,2,3,4,5);
$arr2 = array(0,3,4,5,6);
$temp1 = array_intersect($arr1,$arr2);
print_r($temp1);
Now $temp array will contain (3,4,5)
