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; } 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.10.0030.01414.97
7.4.00.0080.01015.34
7.3.130.0120.00614.88
7.3.120.0070.01115.18
7.3.110.0040.01215.15
7.3.100.0020.01415.05
7.3.90.0040.01114.94
7.3.80.0050.00915.08
7.3.70.0040.01015.11
7.3.60.0030.01114.99
7.3.50.0050.00614.94
7.3.40.0060.00814.96
7.3.30.0020.01214.90
7.3.20.0060.00716.80
7.3.10.0030.01316.91
7.3.00.0030.01116.74
7.2.260.0040.01415.45
7.2.250.0070.01115.20
7.2.240.0070.00815.19
7.2.230.0030.01215.25
7.2.220.0080.00815.16
7.2.210.0050.00715.13
7.2.200.0060.00615.08
7.2.190.0050.00615.27
7.2.180.0050.00815.22
7.2.170.0030.00615.21
7.2.160.0030.00715.33
7.2.150.0030.00917.03
7.2.140.0070.00917.20
7.2.130.0120.00517.21
7.2.120.0030.01017.22
7.2.110.0100.00517.06
7.2.100.0060.00917.15
7.2.90.0080.00917.18
7.2.80.0080.00717.02
7.2.70.0090.00817.02
7.2.60.0050.00817.07
7.2.50.0050.00817.14
7.2.40.0080.00817.22
7.2.30.0090.00717.22
7.2.20.0040.00717.16
7.2.10.0030.01217.18
7.2.00.0090.00317.03
7.1.330.0090.00615.90
7.1.320.0050.00515.99
7.1.310.0030.01116.02
7.1.300.0080.00516.04
7.1.290.0050.00716.00
7.1.280.0030.00816.03
7.1.270.0020.01015.88
7.1.260.0100.00616.09
7.1.250.0070.00616.01
7.1.240.0020.01015.82
7.1.230.0090.00716.17
7.1.220.0080.00815.93
7.1.210.0020.00715.84
7.1.200.0030.01015.90
7.1.190.0050.00716.08
7.1.180.0050.00916.02
7.1.170.0060.00716.10
7.1.160.0090.00615.98
7.1.150.0030.00815.88
7.1.140.0040.00816.10
7.1.130.0050.00715.94
7.1.120.0020.00916.09
7.1.110.0080.00615.93
7.1.100.0050.00515.85
7.1.90.0070.00416.06
7.1.80.0050.00816.05
7.1.70.0050.00716.54
7.1.60.0060.00817.04
7.1.50.0070.01016.42
7.1.40.0100.00315.99
7.1.30.0070.00415.91
7.1.20.0020.00916.06
7.1.10.0040.00815.94
7.1.00.0090.02718.18
7.0.330.0030.01015.69
7.0.320.0070.00815.68
7.0.310.0090.00315.60
7.0.300.0060.00615.45
7.0.290.0060.00815.53
7.0.280.0050.00715.70
7.0.270.0080.00615.62
7.0.260.0050.00415.53
7.0.250.0030.00915.58
7.0.240.0070.00815.71
7.0.230.0040.00915.52
7.0.220.0050.00715.54
7.0.210.0030.01015.67
7.0.200.0180.01115.21
7.0.190.0100.00515.51
7.0.180.0060.00615.57
7.0.170.0070.00715.55
7.0.160.0050.00715.68
7.0.150.0090.00415.80
7.0.140.0080.02417.70
7.0.130.0030.00815.70
7.0.120.0060.00615.62
7.0.110.0030.00915.67
7.0.100.0020.01115.57
7.0.90.0030.00715.46
7.0.80.0060.01015.64
7.0.70.0020.02817.72
7.0.60.0020.02717.68
7.0.50.0060.03417.80
7.0.40.0030.03115.76
7.0.30.0020.03415.84
7.0.20.0050.03415.86
7.0.10.0020.02915.65
7.0.00.0050.02715.83
5.6.400.0040.01114.66
5.6.390.0050.00714.55
5.6.380.0080.00614.55
5.6.370.0030.01114.29
5.6.360.0030.00814.20
5.6.350.0030.01014.43
5.6.340.0060.00514.54
5.6.330.0040.01014.55
5.6.320.0060.01114.40
5.6.310.0050.00514.48
5.6.300.0060.00514.50
5.6.290.0060.00814.45
5.6.280.0050.02916.87
5.6.270.0020.01214.16
5.6.260.0030.00914.38
5.6.250.0030.01114.59
5.6.240.0100.00514.51
5.6.230.0040.01114.64
5.6.220.0050.02216.54
5.6.210.0080.02716.46
5.6.200.0060.03116.74
5.6.190.0030.02416.70
5.6.180.0040.02716.67
5.6.170.0050.03116.68
5.6.160.0050.02516.55
5.6.150.0040.03416.71
5.6.140.0040.03316.63
5.6.130.0040.03016.69
5.6.120.0060.03416.54
5.6.110.0050.03516.63
5.6.100.0040.03316.75
5.6.90.0060.03416.51
5.6.80.0060.01616.38
5.6.70.0040.02116.42
5.6.60.0030.03316.29
5.6.50.0060.03216.33
5.6.40.0090.02216.36
5.6.30.0080.02916.37
5.6.20.0060.02416.32
5.6.10.0060.02816.42
5.6.00.0060.03016.35
5.5.380.0080.00714.54
5.5.370.0080.00614.51
5.5.360.0060.02016.48
5.5.350.0060.03316.39
5.5.340.0060.02716.74
5.5.330.0060.03216.57
5.5.320.0030.02916.58
5.5.310.0010.02616.57
5.5.300.0050.03516.54
5.5.290.0050.03216.53
5.5.280.0050.03316.51
5.5.270.0050.03316.45
5.5.260.0010.03716.67
5.5.250.0050.02816.29
5.5.240.0080.03116.30
5.5.230.0030.02516.40
5.5.220.0060.02916.30
5.5.210.0080.02216.39
5.5.200.0080.02916.21
5.5.190.0070.02916.27
5.5.180.0050.02716.22
5.5.170.0030.01014.46
5.5.160.0090.02816.22
5.5.150.0030.03016.17
5.5.140.0060.03116.15
5.5.130.0100.02516.23
5.5.120.0040.01716.22
5.5.110.0020.03016.24
5.5.100.0060.03216.24
5.5.90.0070.02916.35
5.5.80.0030.02816.29
5.5.70.0060.02216.08
5.5.60.0060.03116.36
5.5.50.0080.02916.17
5.5.40.0100.02716.15
5.5.30.0040.03216.38
5.5.20.0040.03516.27
5.5.10.0040.03316.28
5.5.00.0020.02316.35
5.4.450.0040.03013.95
5.4.440.0020.03513.85
5.4.430.0020.02113.96
5.4.420.0040.03114.05
5.4.410.0020.03113.95
5.4.400.0060.01913.83
5.4.390.0050.02713.83
5.4.380.0020.03013.82
5.4.370.0040.03113.94
5.4.360.0010.03113.76
5.4.350.0060.01713.83
5.4.340.0070.03113.81
5.4.330.0030.00711.04
5.4.320.0020.03213.76
5.4.310.0020.03213.88
5.4.300.0050.03013.96
5.4.290.0060.02813.69
5.4.280.0090.01913.73
5.4.270.0030.02413.85
5.4.260.0020.02613.77
5.4.250.0030.03113.79
5.4.240.0010.03013.94
5.4.230.0040.02413.76
5.4.220.0010.03213.93
5.4.210.0040.02413.82
5.4.200.0090.02313.63
5.4.190.0050.02613.79
5.4.180.0030.03013.57
5.4.170.0030.02913.70
5.4.160.0040.02413.87
5.4.150.0020.02413.81
5.4.140.0050.01812.83
5.4.130.0060.02812.77
5.4.120.0050.02812.89
5.4.110.0050.02912.93
5.4.100.0030.02812.97
5.4.90.0070.02113.03
5.4.80.0090.02312.95
5.4.70.0060.02412.86
5.4.60.0010.02812.94
5.4.50.0030.02912.92
5.4.40.0040.02612.88
5.4.30.0020.03012.83
5.4.20.0020.02512.95
5.4.10.0030.02112.90
5.4.00.0070.02612.66
5.3.290.0060.02612.03
5.3.280.0020.02911.91
5.3.270.0030.02911.96
5.3.260.0020.02811.93
5.3.250.0030.02911.99
5.3.240.0020.02011.96
5.3.230.0100.01911.96
5.3.220.0040.02711.91
5.3.210.0060.02711.82
5.3.200.0050.02511.91
5.3.190.0030.01811.87
5.3.180.0030.02811.91
5.3.170.0040.02912.04
5.3.160.0050.02512.03
5.3.150.0080.02711.93
5.3.140.0040.02912.04
5.3.130.0020.03111.91
5.3.120.0060.02711.83
5.3.110.0050.02111.88
5.3.100.0050.02711.80
5.3.90.0020.01711.73
5.3.80.0080.02611.65
5.3.70.0070.02811.73
5.3.60.0050.02211.67
5.3.50.0030.02911.80
5.3.40.0030.02411.68
5.3.30.0020.02911.74
5.3.20.0060.02611.68
5.3.10.0050.02111.54
5.3.00.0030.02011.43
5.2.170.0030.04712.59
5.2.160.0000.06312.59
5.2.150.0070.06012.59
5.2.140.0070.04712.59
5.2.130.0030.06312.59
5.2.120.0030.06312.59
5.2.110.0000.04312.59
5.2.100.0100.05712.59
5.2.90.0000.05312.59
5.2.80.0030.05012.59
5.2.70.0030.06312.59
5.2.60.0030.06012.59
5.2.50.0000.06312.59
5.2.40.0030.06012.59
5.2.30.0000.04712.59
5.2.20.0070.05712.59
5.2.10.0030.03712.59
5.2.00.0030.06312.59
5.1.60.0000.05312.59
5.1.50.0130.04312.59
5.1.40.0030.05312.59
5.1.30.0070.05312.59
5.1.20.0000.05012.59
5.1.10.0000.06012.59
5.1.00.0070.05012.59
5.0.50.0100.04012.59
5.0.40.0030.04712.59
5.0.30.0000.06712.59
5.0.20.0000.04712.59
5.0.10.0030.04012.59
5.0.00.0000.06712.59
4.4.90.0030.03712.59
4.4.80.0000.03312.59
4.4.70.0000.02712.59
4.4.60.0030.03312.59
4.4.50.0000.03712.59
4.4.40.0030.05312.59
4.4.30.0030.03712.59
4.4.20.0000.04012.59
4.4.10.0030.03312.59
4.4.00.0030.05012.59
4.3.110.0030.03712.59
4.3.100.0000.03312.59
4.3.90.0030.03012.59
4.3.80.0030.05012.59
4.3.70.0000.03712.59
4.3.60.0030.03312.59
4.3.50.0000.03712.59
4.3.40.0000.05012.59
4.3.30.0030.03712.59
4.3.20.0000.04012.59
4.3.10.0030.03312.59
4.3.00.0000.03712.59

preferences:
35.45 ms | 401 KiB | 5 Q