array_udiff_uassoc

PHP 5, PHP 7, PHP 8
array_udiff_uassoc - Computes the difference of arrays with additional index check, compares data and indexes by a callback function
Manual
Code Examples

array_udiff_uassoc(
     array$array,
     ... array$arrays,
     callable$value_compare_func,
     callable$key_compare_func
): array

Computes the difference of arrays with additional index check, compares data and indexes by a callback function.

Note that the keys are used in the comparison unlike array_diff and array_udiff.

Parameters

array

The first array.

arrays

Arrays to compare against.

value_compare_func

The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

callback(mixed$a,mixed$b ): int
key_compare_func

The comparison of keys (indices) is done also by the callback function key_compare_func. This behaviour is unlike what array_udiff_assoc does, since the latter compares the indices by using an internal function.

Return Values

Returns an array containing all the values from array that are not present in any of the other arguments.

Notes

Note:

Please note that this function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using, for example, array_udiff_uassoc($array1[0], $array2[0], "data_compare_func", "key_compare_func");.

Related Functions

Example of array_udiff_uassoc

Show all examples for array_udiff_uassoc

PHP Version: