Source Code:
(back to article)
<?php function compare_numbers($a, $b) { if ($a == $b) { return 0; } elseif ($a < $b) { return -1; } else { return 1; } } $array1 = [1, 2, 3, 4, 5]; $array2 = [2, 4, 6]; $result = array_udiff($array1, $array2, 'compare_numbers'); print_r($result); ?>
Result:
Report an issue