PHP array_diff_ukey() Function
PHP array diff_ukey() Function
Last Updated : 17 Mar 2025
The array_diff_ukey() is an inbuilt function in PHP. The array_diff_ukey() function compares the keys of two or more arrays with a user-defined function, and returns an array that contains the entries from array1 that are not present in array2 or array3, etc.
This function was introduced in PHP 5.1.
Syntax
| Parameter | Description | Is compulsory |
|---|---|---|
| array1 | The array to compare from | Compulsory |
| array2 | An array to compare against | Compulsory |
| array3 | More arrays to compare against | Optional |
| User defined function | A string that define a callable comparison function. | Compulsory |
Return Type
It returns an array containing all the entries from array1 that are not present in any of the other arrays.
Example 1
Output:
Array( [c] => 3 [j] => phptpoint.com )
Example 2
Output:
Array ( [c] => cat )
Example 3
Output:
Array( [c] => php )
Example 4
Output:
Array( [z] => football )
Next TopicPhp-array-each-function