Php-Arrays function-array_intersect-calculates the intersection of Arrays. Array_intersect () calculates the intersection of arrays [function] This function returns an array that contains all the key names in the array of array1 but not in any other parameter array. Array_intersect () calculates the intersection of arrays
[Function]
This function returns an array,
This array contains all the key names in the array of array1 but not in any other parameter.
Note that the key name remains unchanged
Scope of use]
Php 4> 4.0.1 and php5.
[Use]
Array array_intersect_ukey (array array1, array array2 [, array...])
Array1/required/array 1
Array2/required/compared arrays must have at least one
Array.../optional/array for comparison
[Example]
[Php]
// Define two arrays respectively
$ Array1 = array ("blue" => 5, "red" => 2, "green" => 3, "purple" => 4 );
$ Array2 = array ("green" => 5, "blue" => 6, "yellow" => 7, "cyan" => 8 );
Var_dump (array_intersect ($ array1, $ array2 ));
/*
Array (1 ){
["Blue"] =>
Int (5)
}
*/
Taken from zuodefeng's note
Http://www.bkjia.com/PHPjc/478211.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478211.htmlTechArticlearray_intersect () calculates the intersection of arrays [function] This function returns an array containing all the key names in the array of array1 but not in any other parameter ....