PHP array_uintersect_assoc() Function

PHP array_uintersect_assoc Function


Definition :

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

This function compares the keys and values of two (or more) arrays, and return an array that contains the entries from array1 that are present in array2, array3, etc.

Syntax

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

  array_uintersect_assoc(array1array2...value_compare_function);

Parameters

The array_uintersect_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.

Example1 :  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 matches:

Output : 

Array
(
    [a] => web
)