3v4l.org

run code in 300+ PHP versions simultaneously
<?php $initial = rand(0, 100)/100; if ($initial < .25) { $random = rand(0, 9); } elseif ($initial < .5) { $random = rand(10, 99); } elseif ($initial < .75) { $random = rand(100, 999); } elseif ($initial >= .75) { $random = rand(1000, 99999); } var_dump($random);
Output for 7.1.10
int(7)
Output for 7.1.9
int(537)
Output for 7.1.8
int(6581)
Output for 7.1.7
int(38894)
Output for 7.1.6
int(64756)
Output for 7.1.5
int(604)
Output for 7.1.4
int(295)
Output for 7.1.3
int(3)
Output for 7.1.2
int(18021)
Output for 7.0.16, 7.1.1
int(2)
Output for 7.1.0
int(116)
Output for 7.0.24
int(137)
Output for 7.0.23
int(96)
Output for 7.0.22
int(20997)
Output for 7.0.21
int(21)
Output for 7.0.20
int(797)
Output for 7.0.19
int(407)
Output for 7.0.18
int(64)
Output for 7.0.17
int(71958)
Output for 7.0.15
int(752)
Output for 7.0.14
int(802)
Output for 7.0.13
int(8)
Output for 7.0.12
int(884)
Output for 7.0.11
int(41971)
Output for 7.0.10
int(4)
Output for 7.0.9
int(30)
Output for 7.0.8
int(877)
Output for 7.0.7
int(10606)
Output for 7.0.6
int(0)
Output for 7.0.5
int(396)
Output for 7.0.4
int(74)
Output for 7.0.3
int(81)
Output for 7.0.2
int(6)
Output for 7.0.1
int(847)
Output for 7.0.0
int(97335)