3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = 1111111.505; $round = round($a, 2); echo "round: " . $round . "\n"; $sprintf = sprintf('%01.2F', $a); echo "sprintf: " . $sprintf . "\n"; echo "round * 100: "; echo bcmul($round, 100). "\n"; echo "sprintf * 100: "; echo bcmul($sprintf, 100). "\n";
Output for 5.3.0 - 7.1.0
round: 1111111.51 sprintf: 1111111.50 round * 100: 111111151 sprintf * 100: 111111150
Output for 4.3.10 - 4.4.9, 5.0.3 - 5.2.17
round: 1111111.5 sprintf: 1111111.50 round * 100: 111111150 sprintf * 100: 111111150
Output for 4.3.2 - 4.3.9, 5.0.0 - 5.0.2
round: 1111111.5 sprintf: round * 100: 111111150 sprintf * 100: 0
Output for 4.3.0 - 4.3.1
round: 1111111.5 sprintf: round * 100: 111111100 sprintf * 100: 0