Judge whether array B exists the value in array A. this post is edited by xiangqiankun520 at 2014-12-110. ask your predecessors for the two arrays arr1 & nbsp; arr2, if arr2 contains A value of arr1, the output arr2 contains the value of arr1 & nbsp; Array (& nb determines whether Array B has A value in Array.
This post was last edited by xiangqiankun520 at 04:19:34
Ask your predecessors,
Two arrays: arr1 arr2
To achieve this, if a value of arr1 exists in arr2, the output arr2 contains the value of arr1.
Arr1 = Array ([0] => 7 [1] => 100 );
Arr2 = Array ([0] => 2 [1] => 8 [2] => 9 [3] => 1001 [4] => 7 );
If (){
Echo "arr2 already contains the value in arr1 ";
}
------ Solution ----------------------
Intersection is not empty
Count (array_intersect ($ A, $ B)> 0
------ Solution ----------------------
$ Arr1 = Array (7,100 );
$ Arr2 = Array (2, 8, 9, 1001, 7 );
Print_r (array_uintersect ($ arr1, $ arr2, "strcasecmp "));
------ Solution ----------------------
Use the array_intersect function to implement the functions you want.
------ Solution ----------------------
The intersection will be known.
$arr1 = array(1,2,3);
$arr2 = array(1,3,4,5);
check($arr1, $arr2);
function check($arr1, $arr2){
$result = array_intersect($arr1, $arr2);
print_r($result);
}