3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function random($length = 10, $charlist = '0-9a-z') { $charlist = str_shuffle(preg_replace_callback('#.-.#', function($m) { return implode('', range($m[0][0], $m[0][2])); }, $charlist)); $chLen = strlen($charlist); static $rand3; if (!$rand3) { $rand3 = md5(serialize($_SERVER), TRUE); } $s = ''; for ($i = 0; $i < $length; $i++) { if ($i % 5 === 0) { list($rand, $rand2) = explode(' ', microtime()); $rand += lcg_value(); } $rand *= $chLen; $s .= $charlist[($rand + $rand2 + ord($rand3[$i % strlen($rand3)])) % $chLen]; $rand -= (int) $rand; } return $s; } echo random(20, "0-68-9");
Output for 7.1.0
40850496183201234111
Output for 7.0.14
43994346038959035502
Output for 7.0.12
98656925915831559244
Output for 7.0.6
18042915938960938258
Output for 7.0.5
01044609040589203541
Output for 7.0.4
33388512365613206863
Output for 7.0.3
39014393855101011613
Output for 7.0.2
56268382588293218235
Output for 7.0.1
43659345566182831365
Output for 7.0.0
11133983565929146923
Output for hhvm-3.12.0
84054020081901048418
Output for hhvm-3.10.0
33324455258019482185
Output for 5.6.28
20490321538136951222
Output for 5.6.21
13436903110083533851
Output for 5.6.20
50656398854536241651
Output for 5.6.19
44158694645121065326
Output for 5.6.18
12425824086234943144
Output for 5.6.17
21805963310865208956
Output for 5.6.16
49125541923602461048
Output for 5.6.15
11616205352106696010
Output for 5.6.14
38258902423994599156
Output for 5.6.13
00956629351591403936
Output for 5.6.12
33998019313893653831
Output for 5.6.11
53061629956939442022
Output for 5.6.10
92138098158662926083
Output for 5.6.9
96954150439246062841
Output for 5.6.8
11203625160636606061
Output for 5.5.35
16636450490151299052
Output for 5.5.34
50064225140496008885
Output for 5.5.33
48525289200945255891
Output for 5.5.32
04894325610368895166
Output for 5.5.31
32824562369109324888
Output for 5.5.30
92532640465269202050
Output for 5.5.29
11139609235695263219
Output for 5.5.28
54825855423322682864
Output for 5.5.27
81909185061228542004
Output for 5.5.26
81049585580841208418
Output for 5.5.25
06642888289811320832
Output for 5.5.24
59866448059598649524
Output for 5.4.45
53433226905381669225
Output for 5.4.44
64098133212162105589
Output for 5.4.43
49335639100292695120
Output for 5.4.42
11501298123461035964
Output for 5.4.41
85566338101246482195
Output for 5.4.40
05326853582998553385
Output for 5.4.39
10933314246395199118
Output for 5.4.38
09505419984154283995
Output for 5.4.37
09139139319965686306
Output for 5.4.36
34648308834100401952
Output for 5.4.35
83081493935900886958
Output for 5.4.34
58329438392452686504
Output for 5.4.32
30450259541283932840
Output for 5.4.31
31000584134893220911
Output for 5.4.30
32536184192483669693
Output for 5.4.29
03053594323980822352
Output for 5.4.28
48893233615859505112
Output for 5.4.27
51098186294134051489
Output for 5.4.26
90850024812161392662
Output for 5.4.25
84029839329064902426
Output for 5.4.24
35198983623135909596
Output for 5.4.23
84313201338423105619
Output for 5.4.22
95896098866605828981
Output for 5.4.21
26989308048659824023
Output for 5.4.20
03528068832464054835
Output for 5.4.19
62159040583049051036
Output for 5.4.18
88632440668532205950
Output for 5.4.17
60561953013608525606
Output for 5.4.16
68586204830485642649
Output for 5.4.15
80325800985319338363
Output for 5.4.14
12200818886130504825
Output for 5.4.13
15160429428902010394
Output for 5.4.12
60120369969066508522
Output for 5.4.11
60694906658262909492
Output for 5.4.10
56189319033281998359
Output for 5.4.9
38225986548969116865
Output for 5.4.8
14524229442308189945
Output for 5.4.7
42021626022883414995
Output for 5.4.6
28008435164382648164
Output for 5.4.5
03998995293863859251
Output for 5.4.4
08339833345343033425
Output for 5.4.3
05505441101358468601
Output for 5.4.2
64329649613264955823
Output for 5.4.1
05221632800963564593
Output for 5.4.0
15491868680295469235
Output for 5.3.29
08216142022118916645
Output for 5.3.28
29599458183061149009
Output for 5.3.27
51355546092026551930
Output for 5.3.26
94400960925342106596
Output for 5.3.25
90996358339382824934
Output for 5.3.24
32853254234513691019
Output for 5.3.23
68996510664148836506
Output for 5.3.22
32442332148433824163
Output for 5.3.21
05195382211244113629
Output for 5.3.20
23888365864531383131
Output for 5.3.19
64830594332869890292
Output for 5.3.18
26613180283985349983
Output for 5.3.17
58802192613298612883
Output for 5.3.16
04896199341485443366
Output for 5.3.15
44199259553995423892
Output for 5.3.14
68331061536612016431
Output for 5.3.13
40102552566568413654
Output for 5.3.12
04339631150020264629
Output for 5.3.11
41401595645333859182
Output for 5.3.10
93101909280956933688
Output for 5.3.9
04861284956405010843
Output for 5.3.8
35462438499339884123
Output for 5.3.7
84682643591094493200
Output for 5.3.6
03658560589649510162
Output for 5.3.5
88824585099415123592
Output for 5.3.4
39854815342051691866
Output for 5.3.3
99916002030691600545
Output for 5.3.2
81931198455389119821
Output for 5.3.1
19090104112664030355
Output for 5.3.0
62119218593659293099
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/qrMVQ on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/qrMVQ on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/qrMVQ on line 4
Process exited with code 255.