The array_diff_key () function uses the key name to compare the difference set of the calculated array. [function] This function returns an array, this array contains all the key names in the array of array1 but not in any other parameter. [Scope of use] & gt; 5.1.0 [use] arrayarray_diff... SyntaxHighlight
The array_diff_key () function uses the key name to compare the difference set of the calculated array.
[Function]
This function returns an array,
This array contains all the key names in the array of array1 but not in any other parameter.
Scope of use]
> = 5.1.0
[Use]
Array array_diff_key (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]
$ Arr1 = array ("key1" => "val1", "key2" => "val2 ");
$ Arr2 = array ("key1" => "val1", "key3" => "val2 ");
$ Arr3 = array ("key2" => "val2 ");
Print_r (array_diff_key ($ arr1, $ arr2 ));
Print_r (array_diff_key ($ arr1, $ arr3 ));
Print_r (array_diff_key ($ arr1, $ arr2, $ arr3 ));
/*
Array
(
[Key2] => val2
)
Array
(
[Key1] => val1
)
Array
(
)
*/
Taken from zuodefeng's note