3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array('10' => 'a', '20' => 'b', '30' => 'c', '40' => 'd', '50' => 'e'); $keys = array_keys($data); $max = 38; $belowMax = array_filter( $keys, function($num) use ($max) { return $num < $max; } ); $highest = max($belowMax); echo '<pre>'. print_r($highest, 1). '</pre>';

preferences:
59.45 ms | 1457 KiB | 5 Q