3v4l.org

run code in 300+ PHP versions simultaneously
<?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); }

preferences:
50.23 ms | 402 KiB | 5 Q