3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ ['foo' => 'bar'], ['foo' => 'bit'], ['foo' => 'biz'], ['foo' => 'bat'], ['foo' => 'baz'], ]; $arr2 = ['bit','bat']; $arr3 = array_filter($arr1, function ($v) use ($arr2) { return array_search($v['foo'],$arr2) !== false; }); print_r($arr3);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
Array ( [1] => Array ( [foo] => bit ) [3] => Array ( [foo] => bat ) )

preferences:
176.99 ms | 404 KiB | 195 Q