3v4l.org

run code in 300+ PHP versions simultaneously
<?php const RATE = 100; const ITERATIONS = 10_00_000; const EXPECTED = ITERATIONS / RATE; $actual_A = 0; mt_srand(64895); $i = ITERATIONS; while ($i--) { if (mt_rand(0, RATE - 1) == 0) { $actual_A++; } } $actual_B = 0; mt_srand(64895); $i = ITERATIONS; while ($i--) { if (mt_rand(1, RATE) == 1) { $actual_B++; } } echo "Actual A: $actual_A\n"; echo "Actual B: $actual_B\n"; echo "Expected: " . EXPECTED . "\n";
Output for git.master, git.master_jit
Actual A: 9965 Actual B: 9965 Expected: 10000

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:
27.77 ms | 405 KiB | 5 Q