3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function value_compare_func($a, $b){ if ($a === 'n_3') { return 0; } return 1; } $array1 = array("n_1", "n_2", "n_3", "n_4" ); $array2 = array("green"); $result = array_udiff($array1, $array2, "value_compare_func"); print_r($result);
based on ts9Om
Output for 7.0.0 - 7.2.0
Array ( [0] => n_1 [1] => n_2 )
Output for 5.3.19 - 5.6.28
Array ( [1] => n_2 [3] => n_4 )