PHP array_udiff_assoc() Function
Last Updated : 17 Mar 2025
The array_udiff_assoc( ) function is an inbuilt function of PHP. The array_udiff_assoc( ) function use a built-in function to compare the keys and values of two or more arrays, and returns the differences. This function was introduced in PHP 5.0.
Syntax
Parameters
| Parameter | Description | Is compulsory |
|---|---|---|
| array1 | It specifies an array. | compulsory |
| array2 | Specifies an array to be compared with the first array. | compulsory |
| array3 | Specifies an array to be compared with the first array. | Optional |
| Value_compare_function | The name of the user- made function. | compulsory |
Return Values
The array_udiff_assoc( ) function returns an array containing the entries from array1 that are not present in any of the other arrays.
Example 1
Output:
Array
(
[b] =>hp
[c] =>asus
)
Example 2
Output:
Array
(
[b] => cricket
[c] => football )
Example 3
Output:
Array
(
[b] =>sehwag
[r] =>virat
)
Example 4
Output:
Array
(
[b] => java
[c] => python
)
Next TopicPhp-array-udiff-function