Array_intersect_ukey () uses the callback function to compare key names to calculate 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. This comparison is performed through the callback function provided by the user .... SyntaxHighlighter. all ();
Array_intersect_ukey () uses the callback function to compare key names to calculate 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.
This comparison is performed through the callback function provided by the user.
If the first parameter is considered to be less than, equal to, or greater than the second parameter
An integer smaller than zero, equal to zero, or greater than zero
Scope of use]
Php5> 5.1.0.
[Use]
Array array_intersect_ukey (array array1, array array2 [, array..., callback key_compare_func])
Array1/required/array 1
Array2/required/compared arrays must have at least one
Array.../optional/array for comparison
Key_compare_func.../optional/provides a standard callback function.
[Example]
[Php]
Function key_compare_func ($ key1, $ key2)
{
If ($ key1 = $ key2)
Return 0;
Else if ($ key1> $ key2)
Return 1;
Else
Return-1;
}
// Define two arrays respectively
$ Array1 = array ("blue" => 1, "red" => 2, "green" => 3, "purple" => 4 );
$ Array2 = array ("green" => 5, "blue" => 6, "yellow" => 7, "cyan" => 8 );
Var_dump (array_intersect_ukey ($ array1, $ array2, 'Key _ compare_func '));
/*
Array (2 ){
["Blue"] =>
Int (1)
["Green"] =>
Int (3)
}
*/
Taken from zuodefeng's note