3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( array('ITEM' => 1), array('ITEM' => 2), array('ITEM' => 3), ); $array2 = array( array('ITEMID' => 2), array('ITEMID' => 3), array('ITEMID' => 1), array('ITEMID' => 4), ); // PHP7.4+ (arrow functions) var_export( array_udiff($array2, $array1, fn($a, $b) => ($a['ITEM'] ?? $a['ITEMID']) <=> ($b['ITEM'] ?? $b['ITEMID'])) );
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.26, 8.1.0 - 8.1.13
array ( 3 => array ( 'ITEMID' => 4, ), )

preferences:
55.27 ms | 417 KiB | 14 Q