3v4l.org

run code in 300+ PHP versions simultaneously
<?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");

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.00.0170.00315.02
7.3.120.0100.01015.09
7.3.110.0130.00615.23
7.3.100.0090.00615.21
7.3.90.0070.01014.70
7.3.80.0030.00914.77
7.3.70.0090.00615.04
7.3.60.0070.01015.01
7.3.50.0100.00615.01
7.3.40.0040.01215.07
7.3.30.0000.00915.08
7.3.20.0130.00017.04
7.3.10.0080.00516.86
7.3.00.0110.00516.96
7.2.250.0070.01415.31
7.2.240.0100.01015.33
7.2.230.0090.00615.37
7.2.220.0040.00815.46
7.2.210.0030.01015.22
7.2.200.0090.00614.91
7.2.190.0070.01015.23
7.2.180.0040.00815.28
7.2.170.0070.01015.28
7.2.160.0070.01115.07
7.2.150.0070.01017.34
7.2.140.0040.01116.84
7.2.130.0020.01217.13
7.2.120.0090.00717.12
7.2.110.0050.01017.01
7.2.100.0080.00817.05
7.2.90.0060.01117.27
7.2.80.0070.01117.14
7.2.70.0040.01217.12
7.2.60.0050.00917.22
7.2.50.0080.00416.97
7.2.40.0080.00817.11
7.2.30.0030.01217.09
7.2.20.0090.00917.17
7.2.10.0100.00416.98
7.2.00.0030.01217.86
7.1.330.0000.01316.16
7.1.320.0040.00815.88
7.1.310.0040.00415.62
7.1.300.0030.00815.97
7.1.290.0090.00615.94
7.1.280.0090.00615.93
7.1.270.0100.00316.07
7.1.260.0000.01515.96
7.1.250.0100.00515.94
7.1.70.0030.00717.38
7.1.60.0090.01619.40
7.1.50.0090.01216.97
7.1.00.0030.03322.53
7.0.200.0630.00314.96
7.0.140.0100.06721.97
7.0.120.0070.07022.18
7.0.60.0300.07019.79
7.0.50.0130.04317.86
7.0.40.0030.04319.98
7.0.30.0230.04720.25
7.0.20.0400.04320.07
7.0.10.0330.08020.23
7.0.00.0130.06320.08
5.6.280.0070.07021.15
5.6.210.0030.05320.52
5.6.200.0070.05318.30
5.6.190.0030.04720.47
5.6.180.0070.08020.52
5.6.170.0400.05320.45
5.6.160.0130.07320.44
5.6.150.0130.06018.18
5.6.140.0130.04318.19
5.6.130.0070.07318.28
5.6.120.0100.04021.06
5.6.110.0070.03720.99
5.6.100.0070.08320.99
5.6.90.0070.03720.98
5.6.80.0200.05320.37
5.5.350.0270.06720.44
5.5.340.0000.04317.93
5.5.330.0100.05720.38
5.5.320.0170.05720.35
5.5.310.0230.04720.37
5.5.300.0030.08317.98
5.5.290.0000.09018.05
5.5.280.0100.07320.75
5.5.270.0070.04020.80
5.5.260.0030.08320.85
5.5.250.0130.07320.59
5.5.240.0130.06720.13
5.4.450.0000.06019.57
5.4.440.0000.06019.57
5.4.430.0070.08719.57
5.4.420.0070.08319.52
5.4.410.0030.08719.44
5.4.400.0100.07319.08
5.4.390.0070.04319.15
5.4.380.0170.06019.16
5.4.370.0100.03319.21
5.4.360.0100.06719.25
5.4.350.0100.07318.93
5.4.340.0130.07018.86
5.4.320.0030.04019.20
5.4.310.0100.07019.12
5.4.300.0070.04718.85
5.4.290.0130.07018.97
5.4.280.0030.04019.08
5.4.270.0100.07318.87
5.4.260.0030.06318.87
5.4.250.0070.06718.86
5.4.240.0030.06718.91
5.4.230.0130.06319.24
5.4.220.0070.07019.09
5.4.210.0000.05719.20
5.4.200.0000.04318.84
5.4.190.0100.04719.14
5.4.180.0070.08319.02
5.4.170.0070.03719.16
5.4.160.0070.03718.85
5.4.150.0070.03719.06
5.4.140.0100.03716.32
5.4.130.0000.06716.39
5.4.120.0170.06016.47
5.4.110.0100.07016.48
5.4.100.0100.04316.52
5.4.90.0000.04016.49
5.4.80.0070.03716.32
5.4.70.0130.06316.37
5.4.60.0100.07316.41
5.4.50.0030.04016.38
5.4.40.0070.04716.34
5.4.30.0030.06016.27
5.4.20.0070.07016.27
5.4.10.0030.06016.34
5.4.00.0100.03315.76
5.3.290.0130.06314.73
5.3.280.0030.04014.60
5.3.270.0100.04714.66
5.3.260.0100.03014.64
5.3.250.0030.04314.61
5.3.240.0100.07314.62
5.3.230.0030.07714.63
5.3.220.0070.06314.59
5.3.210.0070.06714.60
5.3.200.0100.06714.63
5.3.190.0070.03714.64
5.3.180.0070.05014.72
5.3.170.0100.06714.60
5.3.160.0000.05014.65
5.3.150.0100.07314.57
5.3.140.0030.03714.55
5.3.130.0030.05314.58
5.3.120.0070.06314.56
5.3.110.0030.07714.56
5.3.100.0070.03314.06
5.3.90.0030.04014.08
5.3.80.0000.04014.10
5.3.70.0100.03314.10
5.3.60.0070.03314.06
5.3.50.0030.04713.97
5.3.40.0100.06313.96
5.3.30.0030.07713.96
5.3.20.0030.07713.67
5.3.10.0030.03713.66
5.3.00.0100.07013.82
5.2.170.0100.05011.19
5.2.160.0000.06311.23
5.2.150.0030.04011.04
5.2.140.0070.04711.14
5.2.130.0070.03311.16
5.2.120.0030.02711.17
5.2.110.0100.04011.14
5.2.100.0070.06011.10
5.2.90.0070.05011.26
5.2.80.0030.06311.24
5.2.70.0070.03711.15
5.2.60.0000.04711.00
5.2.50.0070.04711.02
5.2.40.0030.06010.88
5.2.30.0130.04711.04
5.2.20.0000.06010.96
5.2.10.0030.05710.90
5.2.00.0030.06310.71
5.1.60.0100.0479.90
5.1.50.0100.04710.03
5.1.40.0100.04310.12
5.1.30.0030.04310.39
5.1.20.0030.05710.36
5.1.10.0030.05710.04
5.1.00.0030.05310.13
5.0.50.0030.0338.48
5.0.40.0030.0478.36
5.0.30.0030.0378.36
5.0.20.0030.0478.19
5.0.10.0070.0238.17
5.0.00.0000.0478.17
4.4.90.0000.0277.80
4.4.80.0100.0277.80
4.4.70.0070.0307.80
4.4.60.0030.0307.80
4.4.50.0030.0137.80
4.4.40.0000.0477.80
4.4.30.0030.0337.80
4.4.20.0030.0207.80
4.4.10.0030.0377.80
4.4.00.0000.0577.80
4.3.110.0070.0277.80
4.3.100.0030.0337.80
4.3.90.0000.0337.80
4.3.80.0000.0537.80
4.3.70.0000.0237.80
4.3.60.0000.0237.80
4.3.50.0000.0377.80
4.3.40.0030.0337.80
4.3.30.0000.0307.80
4.3.20.0030.0207.80
4.3.10.0000.0237.80
4.3.00.0000.0377.80

preferences:
39.07 ms | 401 KiB | 5 Q