3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $amount = -1 * "99999999999999.999999"; echo "Amount ", var_dump($amount), PHP_EOL; $balance = "0.00"; echo "Balance ", var_dump($balance), PHP_EOL; $amountRounded = round($amount, 2); echo "Amount rounded ", var_dump($amountRounded), PHP_EOL; $newBalance = $balance + $amountRounded; echo "NB ", var_dump($newBalance), PHP_EOL; var_dump($newBalance >= -0.005); var_dump($amount > 0);
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Amount float(-1.0E+14) Balance string(4) "0.00" Amount rounded float(-1.0E+14) NB float(-1.0E+14) bool(false) bool(false)
Output for 4.3.3 - 4.3.9, 5.0.0 - 5.0.1
Amount float(-1.0E+14) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 4 PHP_EOLBalance string(4) "0.00" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 7 PHP_EOLAmount rounded float(-1.0E+14) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 10 PHP_EOLNB float(-1.0E+14) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 14 PHP_EOLbool(false) bool(false)
Output for 4.3.0 - 4.3.2
Amount float(-1.E+14) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 4 PHP_EOLBalance string(4) "0.00" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 7 PHP_EOLAmount rounded float(-1.E+14) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 10 PHP_EOLNB float(-1.E+14) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VT34H on line 14 PHP_EOLbool(false) bool(false)