array_diff_assoc
PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
array_diff_assoc - Computes the difference of arrays with additional index check
array_diff_assoc(
array$array,
... array$arrays ): array
Compares array against arrays and returns the difference. Unlike array_diff the array keys are also used in the comparison.
Parameters
- array
-
The array to compare from
- arrays
-
Arrays to compare against
Return Values
Returns an array containing all the values from array that are not present in any 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, for example, array_diff_assoc($array1[0], $array2[0]);.
Note:
Ensure you pass arguments in the correct order when comparing similar arrays with more keys. The new array should be the first in the list.