Home >> PHP >> array_udiff() function in PHP

array_udiff() function in PHP

The array_udiff() function compares the values by user-defined function of two or more arrays, and returns the differences.




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

$array1 = array("a"=>"red","b"=>"green","c"=>"blue");
$array2 = array("a"=>"red","b"=>"green","d"=>"blue");



Array ( [c] => blue )


Post Your Comment

Next Questions
array_udiff_assoc() function
array_udiff_uassoc() function
array_uintersect() function
array_uintersect_assoc() function
array_uintersect_uassoc() function
array_unique() function
array_unshift() function
array_values() function
array_walk() function
array_walk_recursive() function
asort() function
arsort() function
compact() function
count() function
current() function
each() function
end() function
extract() function
in_array() function
key() function
krsort() function
ksort() function
list() function
natcasesort() function
natsort() function

Copyright ©2022 coderraj.com. All Rights Reserved.