3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Array1 = [ 146, 173 ]; $Array2 = [ 'localhost' => [ 'host_id' => 146 ], '192.168.0.43' => [ 'host_id' => 160 ], '192.168.0.38' => [ 'host_id' => 173 ] ]; $filtered_hosts = array_filter($Array2, function($x) use ($Array1) { return in_array($x['host_id'], $Array1); }); print_r($filtered_hosts);

preferences:
54.01 ms | 405 KiB | 6 Q