PHP array_udiff() Function

The array_udiff() function compares the values of two or more, and returns the differences.

Note: This function uses a user-defined function to compare the values!

Returns an array containing the entries from array1 that are not present in any of the other arrays

Parameter Is Required Description
array1 Required. Array to compare from
array2 Required. Array to compare against
array3,… Optional. More arrays to compare against
myfunction Required. A string that define a callable comparison function.




function myfunctiondemo($a,$b)
if ($a===$b)
  return 0;
  return ($a>$b)?1:-1;




Array ( [a] => Cooper [b] => Samuel ) 

Leave a Reply

Your email address will not be published. Required fields are marked *