Easy Tutorial
❮ Func Mysqli Set Charset Func Curl_Multi_Init ❯

PHP array_udiff_uassoc() Function

Complete PHP Array Reference Manual

Example

Compare the keys and values of two arrays (using user-defined functions for comparison) and return the difference:


Definition and Usage

The array_udiff_uassoc() function is used to compare the keys and values of two (or more) arrays and return the difference.

Note: This function uses two user-defined functions for comparison; the first function compares keys, and the second function compares values!

This function compares the keys and values of two (or more) arrays and returns an array of differences, which includes all keys and values that are present in the first array (array1) but not in any of the other arrays (array2 or array3, etc.).


Syntax

Parameter Description
array1 Required. The first array to compare with other arrays.
array2 Required. The array to compare against the first array.
array3,... Optional. Additional arrays to compare against the first array.
myfunction_key Required. The name of the user-defined function used to compare array keys. <br>A string that defines a callable comparison function. The comparison function must return an integer less than, equal to, or greater than 0 if the first argument is considered to be respectively less than, equal to, or greater than the second.
myfunction_value Required. The name of the user-defined function used to compare array values. <br>A string that defines a callable comparison function. The comparison function must return an integer less than, equal to, or greater than 0 if the first argument is considered to be respectively less than, equal to, or greater than the second.

Technical Details

Return Value: Returns an array containing all the keys and values from array1 that are not present in any of the other arrays (array2 or array3, etc.).
PHP Version: 5+
--- ---
❮ Func Mysqli Set Charset Func Curl_Multi_Init ❯