3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total = 0.0; $expected = 1.0; for ($i = 0; $i < 10; $i++) { $total += 0.1; } echo "added ten cents\n"; // since we added 0.1 € x 10 times, we now have 1€ in total, right? if ($total == $expected) { echo "I have {$expected}€. All is good in the realm."; } else { echo "WTF? Where is my money? I only have {$total}€!!!!\n"; echo "\$total holds:"; var_dump($total); } $balance = 50.03; $debit = 45.42; $expected_balance = 4.61; $real_balance = $balance - $debit; if ($real_balance !== $expected_balance) { echo "balance mismatch: "; var_dump($real_balance); }
Output for git.master, git.master_jit, rfc.property-hooks
added ten cents WTF? Where is my money? I only have 1€!!!! $total holds:float(0.9999999999999999) balance mismatch: float(4.609999999999999)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
57.24 ms | 401 KiB | 8 Q