How to learn PHP array_intersect ()
Definition and usage
The Array_intersect () function returns an array of intersections of two or more arrays.
The result array contains all of the values in the array that are being compared and also in all other parameter arrays, with the key names remaining unchanged.
Note: Only values are used for comparisons.
Grammar
Array_intersect (Array1,array2,array3 ...)
Parameters
Describe
Array1 required. The first array to compare with the other array.
Array2 required. The array to compare with the first array.
Array3 is optional. The array to compare with the first array. Can have more than one.
Example
"Cat",1=> "Dog",2=> "Horse"); $a 2=array (3=> "Horse",4=> "Dog",5=> "Fish"); Print_r (Array_intersect ($a 1, $a 2));?>
Output:
Array ([1] = Dog [2] = Horse)
http://www.bkjia.com/PHPjc/834963.html www.bkjia.com true http://www.bkjia.com/PHPjc/834963.html techarticle How to learn php array_intersect () Definition and usage the Array_intersect () function returns an array of intersections of two or more arrays. The result array contains all of the arrays that are being compared, also out ...