Determine if array B has the value in array a
This post was last edited by xiangqiankun520 on 2014-12-11 04:19:34
Please ask your predecessors,
Two arrays of arr1 arr2
To implement, if there is a value for arr1 in arr2, the output arr2 already contains the value in 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 values in the arr1";
}
------to solve the idea----------------------
Intersection non-null
Count (Array_intersect ($A, $B)) >0
------to solve the idea----------------------
$arr 1 = Array (7, 100);
$arr 2 = Array (2, 8, 9, 1001, 7);
Print_r (Array_uintersect ($arr 1, $arr 2, "strcasecmp"));
------to solve the idea----------------------
Use the function Array_intersect to implement the function you want.
------to solve the idea----------------------
You'll know the intersection.
$arr 1 = Array (All-in-all);
$arr 2 = array (1,3,4,5);
Check ($arr 1, $arr 2);
function Check ($arr 1, $arr 2) {
$result = Array_intersect ($arr 1, $arr 2);
Print_r ($result);
}