PHP array_intersect_uassoc() Function
Last Updated : 17 Mar 2025
The array_intersect_uassoc( ) function is an inbuilt function in PHP. The array_intersect_uassoc( ) function is used to compare key and values of two or more arrays by using a user-defined comparison function and return the matches. It returns an array containing all the values of array1 that are present in all the arguments. This function was introduced in PHP 5.0.
Syntax
Parameter
| Parameter | Description | Is compulsory |
|---|---|---|
| array1 | The first array is the array that the others will be compared with. | compulsory |
| array2 | An array to be compared with the first array. | compulsory |
| array3 | An array to be compared with the first array. | Optional |
| user-defined-function | A string that defines a callable comparison function. The comparison function must return an integer <, =, or > than 0 if the first argument is <, =, or > than the second argument. | compulsory |
Return Type
It returns an array containing all the entries from array1 that are present in all of the other arrays.
EXAMPLE 1
Output:
Array ( [b] => brown )
EXAMPLE 2
Output:
Array ( [a] => football )
EXAMPLE 3
Output:
Array ( [3] => python )
EXAMPLE 4
Output:
Array ( [b] => banana )
Next TopicPhp-array-intersect-ukey-function