PHP array_udiff_assoc() Function

PHP array_udiff_assoc Function


Definition :

The array_udiff_assoc() function compares the values of two or more arrays and returns the differences with additional key check using a user-defined value comparison function.

Syntax :

The basic syntax of the array_udiff_assoc() function is given with:

array_udiff_assoc(array1array2...value_compare_function);

Parameters

The array_udiff_assoc() function accepts the following parameters.

Parameter Description
array1 Required. Specifies the array to compare from.
array2 Required. Specifies an array to compare against.
... Optional. Specifies more arrays to compare against.
value_compare_function  Required. Specifies a callback function to use for value comparison.

 Example : Compare the keys and values of two arrays (using a built-in function to compare the keys and a user-defined function to compare the values) and return the differences.

Output :

Array
(
    [a] => Web
    [b] => Designing
    [c] => House
)