3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Example difference between PHP version compared to 8.4's new technique".PHP_EOL; echo "===================".PHP_EOL; echo round(33.324999999999996,2) . PHP_EOL; echo round(33.334999999999996,2) . PHP_EOL; echo round(33.344999999999996,2) . PHP_EOL; echo round(33.354999999999996,2) . PHP_EOL; echo round(33.364999999999996,2) . PHP_EOL; echo round(33.374999999999996,2) . PHP_EOL; echo round(33.384999999999996,2) . PHP_EOL; echo round(33.394999999999996,2) . PHP_EOL; echo PHP_EOL; echo " simple multiplication " . 25*1.333 .PHP_EOL; echo " rounding that same sum " . round((25*1.333),2) . PHP_EOL; echo " but wait, lets just round 33.325 => " . round(33.325,2) . PHP_EOL;
Output for 8.4.1 - 8.4.13
Example difference between PHP version compared to 8.4's new technique =================== 33.32 33.33 33.35 33.36 33.36 33.37 33.39 33.39 simple multiplication 33.325 rounding that same sum 33.32 but wait, lets just round 33.325 => 33.33
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26
Example difference between PHP version compared to 8.4's new technique =================== 33.33 33.34 33.35 33.36 33.37 33.38 33.39 33.4 simple multiplication 33.325 rounding that same sum 33.33 but wait, lets just round 33.325 => 33.33

preferences:
77.47 ms | 408 KiB | 5 Q