3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a= [['a', 10], ['b', 11], ['c', 12], ['d', 13]]; $b = [['k', 21], ['l', 22], ['m', 23]]; $diff = array_udiff($a, $b, function($o1, $o2) { echo 'comparing ' . $o1[0] . ', ' . $o2[0]; return $o1[1] - $o2[1]; }); var_dump($diff);
based on sP0o4
Output for 7.0.0 - 7.2.0
comparing a, bcomparing b, ccomparing c, dcomparing k, lcomparing l, mcomparing a, kcomparing a, bcomparing b, kcomparing b, ccomparing c, kcomparing c, dcomparing d, karray(4) { [0]=> array(2) { [0]=> string(1) "a" [1]=> int(10) } [1]=> array(2) { [0]=> string(1) "b" [1]=> int(11) } [2]=> array(2) { [0]=> string(1) "c" [1]=> int(12) } [3]=> array(2) { [0]=> string(1) "d" [1]=> int(13) } }
Output for 5.4.11 - 5.6.28
comparing b, acomparing b, ccomparing d, bcomparing c, bcomparing d, ccomparing l, kcomparing m, lcomparing a, kcomparing a, bcomparing b, kcomparing b, ccomparing c, kcomparing c, dcomparing d, karray(4) { [0]=> array(2) { [0]=> string(1) "a" [1]=> int(10) } [1]=> array(2) { [0]=> string(1) "b" [1]=> int(11) } [2]=> array(2) { [0]=> string(1) "c" [1]=> int(12) } [3]=> array(2) { [0]=> string(1) "d" [1]=> int(13) } }
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/pQ6kF on line 3
Process exited with code 255.