3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // https://bugs.php.net/bug.php?id=66011 // Test script as provided in original bug report $a = strval(round(1 / 3, 2)); var_dump($a, serialize($a)); // Code which does show this behaviour // Behaviour as expected, see the warning at http://php.net/manual/en/language.types.float.php $a = round(1 / 3, 2); var_dump($a, serialize($a));
Output for 4.3.0 - 4.3.1, 7.1.0
string(4) "0.33" string(11) "s:4:"0.33";" float(0.33) string(7) "d:0.33;"
Output for 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.14
string(4) "0.33" string(11) "s:4:"0.33";" float(0.33) string(22) "d:0.33000000000000002;"
Output for 5.2.1 - 5.6.25, 7.0.0 - 7.0.10
string(4) "0.33" string(11) "s:4:"0.33";" float(0.33) string(29) "d:0.330000000000000015543122;"
Output for 4.3.2 - 5.2.0
string(4) "0.33" string(11) "s:4:"0.33";" float(0.33) string(29) "d:0.330000000000000026645353;"