3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function convert($input) { $range_input = range(1, 0, 1/127); $range_output = range(0, 127); foreach ($range_input as $key => $value) { if ($value <= $input) { return $range_output[$key]; } } return 127; } foreach(range(0,1,1/1000) as $input) { convert($input); }
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Output for 4.3.0 - 4.3.10, 4.4.0 - 4.4.9
Warning: Wrong parameter count for range() in /in/tm3KM on line 17 Warning: Invalid argument supplied for foreach() in /in/tm3KM on line 17
Output for 4.3.11
Warning: Wrong parameter count for range() in /in/tm3KM on line 17