3v4l.org

run code in 300+ PHP versions simultaneously
<?php $years = [7,8,9]; $students = [ 20=>7, 21=>11, 420=>8, 52=>12, 55=>9 ]; $students = array_filter($students, function($year) use ($years) { return in_array($year, $years); }); print_r($students);

preferences:
62.8 ms | 402 KiB | 5 Q