3v4l.org

run code in 300+ PHP versions simultaneously
<?php $countedZero = 0; $totalGen = 10000; for ($i = 1; $i <= $totalGen; $i++) { $rand = random_int(-9223372036854775808, 9223372036854775807); if ($rand == 0) { $countedZero++; } } echo "0 was generated " . $countedZero . "/" . $totalGen . " times which is " . (($countedZero / $totalGen) * 100) . "%." ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0
0 was generated 0/10000 times which is 0%.
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Fatal error: Call to undefined function random_int() in /in/76aEH on line 6
Process exited with code 255.

preferences:
52.49 ms | 407 KiB | 5 Q