Home > PHP > Function > Arrays > array_udiff_uassoc()

array_udiff_uassoc()

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

Syntax

array array_udiff_uassoc (array $array1, array $array2, array $ ..., callback $data_compare_func, callback $key_compare_func)

Arguments

  • array1 - The first array.
  • array2 - The second array.
  • ... - The callback comparison function. The user supplied callback function is used for comparison. It 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. The comparison of arrays\' data is performed by using an user-supplied callback : data_compare_func. In this aspect the behaviour is opposite to the behaviour of array_diff_assoc() which uses internal function for comparison.
  • data_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.
  • key_compare_func

Description

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

Version

PHP 5

Return value

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