3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ [ 'id' => '1', 'order' => '123238' ], [ 'id' => '2', 'order' => '33278' ], [ 'id' => '3', 'order' => '8892372' ] ]; $arr2 = [ [ 'id' => '1', 'order' => '349483' ], [ 'id' => '2', 'order' => '9837283' ], [ 'id' => '3', 'order' => '33278' ] ]; // values in both $arr1 and $arr2 print_r(array_uintersect($arr1, $arr2, function ($a, $b) { return $a['order'] - $b['order']; })); // values in $arr1 but not $arr2 print_r(array_udiff($arr1, $arr2, function ($a, $b) { return $a['order'] - $b['order']; })); // values in $arr2 but not $arr1 print_r(array_udiff($arr1, $arr2, function ($a, $b) { return $a['order'] - $b['order']; })); ?>

preferences:
171.17 ms | 406 KiB | 5 Q