array_diff_key
PHP 5 >= 5.1.0, PHP 7, PHP 8
array_diff_key - Computes the difference of arrays using keys for comparison
array_diff_key(
array$array,
... array$arrays ): array
Compares the keys from array against the keys from arrays and returns the difference. This function is like array_diff except the comparison is done on the keys instead of the values.
Parameters
- array
-
The array to compare from
- arrays
-
Arrays to compare against
Return Values
Returns an array containing all the entries from array whose keys are absent from all of the other arrays.
Notes
Note:
This function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using array_diff_key($array1[0], $array2[0]);.