3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( array('ITEM' => 1), array('ITEM' => 2), array('ITEM' => 3), ); $array2 = array( array('ITEM' => 2), array('ITEM' => 3), array('ITEM' => 1), array('ITEM' => 4), ); // PHP7.4+ (arrow functions) var_export( array_udiff($array2, $array1, fn($a, $b) => $a['ITEM'] <=> $b['ITEM']) ); echo "\n"; // PHP7+ (spaceship operator) var_export( array_udiff($array2, $array1, function($a, $b) { return $a['ITEM'] <=> $b['ITEM']; }) ); echo "\n"; // PHP5.3+ (anonymous functions) var_export( array_udiff($array2, $array1, function($a, $b) { return $a['ITEM'] === $b['ITEM'] ? 0 : ($a['ITEM'] > $b['ITEM'] ? 1 : -1); }) );
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.26, 8.1.0 - 8.1.13
array ( 3 => array ( 'ITEM' => 4, ), ) array ( 3 => array ( 'ITEM' => 4, ), ) array ( 3 => array ( 'ITEM' => 4, ), )

preferences:
54.46 ms | 409 KiB | 5 Q