3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $intervals = array(0,5,10,12); $len = count($intervals); $result = -1; $needle = 3; for ($i = 0; $i < $len; $i++) { $current = $intervals[$i]; if ($current > $needle) { $result = $i - 1; break; } } var_dump($result);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(0)