Javatpoint Logo
Javatpoint Logo

PHP array diff_ukey() function

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.


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


Array(  [c] => 3   [j] => )

Example 2


Array ( [c] => cat )

Example 3


Array(  [c] => php  )

Example 4


Array(  [z] => football )

Help Others, Please Share

facebook twitter pinterest