3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php for ($i = 0; $i < 10; $i++) { for ($j = 0; $j < 100; $j++) { $valueAsString = $i.".".sprintf('%02d', $j); $valueAsFloat = (float) $valueAsString; $dollars = (int) floor($valueAsFloat); $cents = (int) ($valueAsFloat * 100 % 100); if ($dollars !== $i || $cents !== $j) { echo $valueAsFloat." $i $j $dollars $cents"."\n"; } } }
based on nACN6
Output for 5.5.0 - 7.3.0beta1
0.29 0 29 0 28 0.57 0 57 0 56 0.58 0 58 0 57 1.13 1 13 1 12 1.14 1 14 1 13 1.15 1 15 1 14 1.16 1 16 1 15 2.01 2 1 2 0 2.03 2 3 2 2 2.05 2 5 2 4 2.07 2 7 2 6 2.26 2 26 2 25 2.28 2 28 2 27 2.3 2 30 2 29 2.32 2 32 2 31 2.51 2 51 2 50 2.53 2 53 2 52 2.55 2 55 2 54 4.02 4 2 4 1 4.06 4 6 4 5 4.1 4 10 4 9 4.14 4 14 4 13 4.27 4 27 4 26 4.31 4 31 4 30 4.35 4 35 4 34 4.39 4 39 4 38 4.52 4 52 4 51 4.56 4 56 4 55 4.6 4 60 4 59 4.64 4 64 4 63 4.77 4 77 4 76 4.81 4 81 4 80 4.85 4 85 4 84 4.89 4 89 4 88 5.02 5 2 5 1 5.06 5 6 5 5 5.1 5 10 5 9 8.03 8 3 8 2 8.04 8 4 8 3 8.12 8 12 8 11 8.2 8 20 8 19 8.28 8 28 8 27 8.29 8 29 8 28 8.37 8 37 8 36 8.45 8 45 8 44 8.53 8 53 8 52 8.54 8 54 8 53 8.62 8 62 8 61 8.7 8 70 8 69 8.78 8 78 8 77 8.79 8 79 8 78 8.87 8 87 8 86 8.95 8 95 8 94 9.03 9 3 9 2 9.04 9 4 9 3 9.12 9 12 9 11 9.2 9 20 9 19 9.28 9 28 9 27 9.29 9 29 9 28 9.37 9 37 9 36 9.45 9 45 9 44 9.53 9 53 9 52 9.54 9 54 9 53 9.62 9 62 9 61 9.7 9 70 9 69 9.78 9 78 9 77 9.79 9 79 9 78 9.87 9 87 9 86 9.95 9 95 9 94