Easy Tutorial
❮ Func Misc Time Nanosleep Func Directory Rewinddir ❯

PHP array_udiff_assoc() Function

Complete PHP Array Reference Manual

Example

Compare the key names and key values of two arrays (using a built-in function to compare key names and a user-defined function to compare key values), and return the difference set:


Definition and Usage

The array_udiff() function is used to compare the key names and key values of two (or more) arrays and return the difference set.

Note: This function uses a built-in function to compare key names and a user-defined function to compare key values!

This function compares the key names and key values of two (or more) arrays and returns a difference set array, which includes all key names and key values that are present in the array being compared (array1) but not in any of the other parameter arrays (array2 or array3, etc.).


Syntax

Parameter Description
array1 Required. The first array to compare with other arrays.
array2 Required. An array to compare against the first array.
array3,... Optional. Additional arrays to compare against the first array.
myfunction Required. A string that defines a callable comparison function. 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.

Technical Details

Return Value: Returns a difference set array, which includes all key names and key values present in the array being compared (array1) but not in any of the other parameter arrays (array2 or array3, etc.).
PHP Version: 5+
--- ---
❮ Func Misc Time Nanosleep Func Directory Rewinddir ❯