3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = 0; for($i=1; $i<=10000;$i++) { $rand = random_int(1, 200); if ($rand == 1) $a++; } echo $a;
based on NHkse
Output for 7.0.2, 7.2.6
31
Output for 7.0.16, 7.2.0
47
Output for 7.0.14, 7.0.19, 7.1.10
55
Output for 7.1.7
61
Output for 7.1.6
43
Output for 7.1.5
60
Output for 7.0.8, 7.0.10, 7.0.15, 7.0.20, 7.1.4
44
Output for hhvm-3.15.4, 7.0.0, 7.0.4, 7.1.3
41
Output for 7.0.12, 7.1.2
40
Output for 7.0.3, 7.0.7, 7.0.18, 7.1.1
49
Output for 7.1.0
45
Output for 7.0.6, 7.0.9, 7.0.17
46
Output for 7.0.13
50
Output for 7.0.11
52
Output for 7.0.5
48
Output for 7.0.1
54
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function random_int() in /in/v7UpS on line 5
Process exited with code 255.