3v4l.org

run code in 300+ PHP versions simultaneously
<?php $one = [ ['id'=>182, 'data'=>'foo'], ['id'=>300, 'data'=>'bar'], ['id'=>8, 'data'=>'baz'], ['id'=>52, 'data'=>'bee'] ]; $two = [52, 300]; $result = array_uintersect($one, $two, function($x, $y) { $x = !is_array($x)?:$x['id']; $y = !is_array($y)?:$y['id']; return $x-$y; }); var_dump($result);

preferences:
37.31 ms | 402 KiB | 5 Q