3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function resize($count) { $n = $count % 10; //round the count to the nearest 10... $size = ($n > 5) ? $count - $n : $count + $n; //normalise the size to be between 10 and 100 if ($size < 10) { $size = 10; } elseif ($size > 100) { $size = 100; } //normalise the size to be between 1 and 10 $size = $size/10; return $size; } var_dump(resize(63)); var_dump(resize(65)); var_dump(resize(13)); var_dump(resize(15)); var_dump(resize(21));
Output for 4.3.0 - 7.2.0
float(6.6) int(7) float(1.6) int(2) float(2.2)