PHP array_udiff_assoc() Function

PHP array_udiff_assoc() Function

The array_udiff_assoc () function in PHP computes the difference between the specified arrays with additional index check and compares the data by a callback function. It returns all the values from array1 that are not present in any of the other arguments.

Syntax

Parameter

array1(required)– This array represents the first input array.

array2(required)– This array represents the second input array.

array3….(optional)– It represents more arrays to compare against.

key_compare_func(required)– This parameter represents a string that describe a callable comparison function. The comparison function must return an integer <, =, or > than 0 if the first argument is <, =, or > than the second argument.

Return

This function returns an array containing all the values from array1 that are not present in any of the other arguments. It returns NULL if all the array elements are present in array1.

Example 1

Output

Example 2

Output

Example 3

Output