3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getCoefAtAmericanFormat($coef) { if ($coef == '' || $coef == 0) { return 0; } return $coef == 2 ? "+100" : $coef < 2 ? '-' . floor((100 / (round($coef,2) - 1))) : '+' . floor(((round($coef,2) - 1) * 100)); } echo getCoefAtAmericanFormat(1.04);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
-2499