PHP array_udiff_uassoc() Function
Last Updated : 17 Mar 2025
The array_udiff_uassoc( ) function is an inbuilt function of PHP. The array_udiff_uassoc( ) function compares two or more arrays in two user-made functions, and returns an array containing the elements from the first array. This function was introduced in PHP 5.0.
Syntax
Parameters
| Parameter | Description | Required/Optional |
|---|---|---|
| array1 | Array to compare from. | compulsory |
| array2 | Array to compare against. | compulsory |
| array3 | More arrays to compare against. | Optional |
| Value_compare_function | User-defined function to compare the array values. | compulsory |
| Key_compare_function | User-defined function to compare the array keys. | compulsory |
Return Values
The array_udiff_uassoc( ) function returns an array containing all the values from array1 that are not present in any of the other arguments.
Example 1
Output:
Array
(
[c] => vivo
)
Example 2
Output:
Array
(
[c] =>virat
)
Example 3
Output:
Array
(
[c] =>ndtv
)
Example 4
Output:
Array
(
[m] => C
[n] => Java
[o] => C#
[y] => python
)
Next TopicPhp-array-uintersect-assoc-function