3v4l.org

run code in 300+ PHP versions simultaneously
<?php // EXAMPLE USAGE $array = generate(); echo $array[0]; echo "<br />"; echo $array[1]; // FUNCTION function generate() { $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY"; //now we generate a new random ID number using the substrings of the digitList string above $id = NULL; $id .= substr($digilist, rand(1, 9), 1); //random number $id .= substr($digilist, rand(10, 31), 1); //then a letter $id .= substr($digilist, rand(10, 31), 1); //another letter $id .= substr($digilist, rand(1, 9), 1); //a number $id .= substr($digilist, rand(1, 9), 1); //and finally another number - simple :D //ok so now we need to generate an MD5 hash of our ID $hash = md5($id); //cycle through the hash 16 (length of key) times (in steps of 2 because each hex bytes is 2 digits long) $i = 0; $key = NULL; for ($i; $i < 32; $i+=2) { //here we convert the next hex value to an integer and perform a bitwise AND operation against '31' //31 is the highest substring value in our digit list. $nextdigit = hexdec(substr($hash, $i, 2)) & 31; //if 'i' is divisable by 8 (every 4 cycles) then we want to add "-" if ((($i % 8) == 0) && ($i > 0)) { $key .= "-".substr($digilist, $nextdigit, 1); } else { $key .= substr($digilist, $nextdigit, 1); } } $array = array($id, $key); //return return $array; } ?>

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)
8.0.00.0130.00916.42
7.4.130.0120.00916.02
7.4.120.0120.00915.89
7.4.110.0120.00915.89
7.4.100.0120.00915.91
7.4.90.0120.00915.91
7.4.80.0120.00915.88
7.4.70.0120.00915.93
7.4.60.0120.00915.93
7.4.50.0120.00915.88
7.4.40.0120.00915.89
7.4.30.0120.00915.90
7.4.20.0120.00915.89
7.4.10.0120.00915.91
7.4.00.0110.00916.00
7.3.250.0110.00916.08
7.3.240.0120.00915.95
7.3.230.0120.00915.94
7.3.220.0120.00915.99
7.3.210.0120.00915.97
7.3.200.0120.00915.96
7.3.190.0120.00915.99
7.3.180.0120.00915.97
7.3.170.0120.00915.98
7.3.160.0120.00915.96
7.3.150.0120.00915.97
7.3.140.0120.00915.96
7.3.130.0120.00915.98
7.3.120.0120.00915.97
7.3.110.0120.00915.97
7.3.100.0120.00915.97
7.3.90.0120.00915.97
7.3.80.0120.00915.96
7.3.70.0120.00915.93
7.3.60.0120.00915.93
7.3.50.0120.00915.94
7.3.40.0120.00915.91
7.3.30.0120.00915.94
7.3.20.0130.00915.95
7.3.10.0130.00915.96
7.3.00.0130.00915.96
7.2.340.0120.00916.18
7.2.330.0120.00916.16
7.2.320.0120.00916.19
7.2.310.0120.00916.17
7.2.300.0120.00916.19
7.2.290.0120.00916.15
7.2.280.0120.00916.19
7.2.270.0120.00916.18
7.2.260.0120.00916.18
7.2.250.0120.00916.19
7.2.240.0120.00916.16
7.2.230.0120.00916.18
7.2.220.0120.00916.18
7.2.210.0120.00916.15
7.2.200.0120.00916.16
7.2.190.0120.00916.11
7.2.180.0120.00916.13
7.2.170.0110.00916.12
7.2.160.0120.00916.09
7.2.150.0130.01016.16
7.2.140.0130.00916.15
7.2.130.0130.01016.16
7.2.120.0130.00916.15
7.2.110.0130.00916.14
7.2.100.0130.00916.15
7.2.90.0130.01016.15
7.2.80.0130.01016.14
7.2.70.0130.01016.15
7.2.60.0130.01016.12
7.2.50.0130.00916.12
7.2.40.0130.01016.17
7.2.30.0130.01016.20
7.2.20.0130.01016.12
7.2.10.0130.01016.22
7.2.00.0140.00916.22
7.1.330.0130.00915.22
7.1.320.0130.00915.23
7.1.310.0130.00915.22
7.1.300.0130.00915.16
7.1.290.0130.00915.18
7.1.280.0130.00915.17
7.1.270.0130.00915.17
7.1.260.0130.00915.15
7.1.250.0130.00915.15
7.1.240.0130.00915.12
7.1.230.0130.00915.12
7.1.220.0130.00915.14
7.1.210.0130.00915.13
7.1.200.0130.00915.13
7.1.190.0130.00915.12
7.1.180.0130.00915.15
7.1.170.0130.00915.12
7.1.160.0130.00915.12
7.1.150.0130.00915.13
7.1.140.0130.00915.12
7.1.130.0130.00915.12
7.1.120.0130.00915.12
7.1.110.0130.00915.14
7.1.100.0130.00915.13
7.1.90.0130.00915.13
7.1.80.0130.00915.12
7.1.70.0130.00915.13
7.1.60.0130.00915.13
7.1.50.0130.00915.13
7.1.40.0130.00915.14
7.1.30.0130.00915.15
7.1.20.0130.00915.13
7.1.10.0130.00915.12
7.1.00.0130.00915.08
7.0.330.0130.00814.81
7.0.320.0120.00814.81
7.0.310.0120.00814.81
7.0.300.0120.00814.82
7.0.290.0120.00814.79
7.0.280.0120.00814.80
7.0.270.0120.00814.80
7.0.260.0120.00814.78
7.0.250.0120.00814.81
7.0.240.0120.00814.85
7.0.230.0120.00814.84
7.0.220.0120.00814.84
7.0.210.0120.00814.81
7.0.200.0120.00814.80
7.0.190.0120.00814.83
7.0.180.0120.00814.82
7.0.170.0120.00814.84
7.0.160.0120.00814.81
7.0.150.0120.00814.81
7.0.140.0120.00814.83
7.0.130.0120.00814.80
7.0.120.0120.00814.83
7.0.110.0120.00814.80
7.0.100.0120.00814.80
7.0.90.0120.00814.81
7.0.80.0120.00814.80
7.0.70.0120.00814.82
7.0.60.0120.00814.80
7.0.50.0120.00814.80
7.0.40.0120.00814.78
7.0.30.0120.00814.79
7.0.20.0130.00814.79
7.0.10.0120.00814.81
7.0.00.0120.00814.78
5.6.400.0120.01115.45
5.6.390.0120.01115.49
5.6.380.0120.01115.44
5.6.370.0120.01115.45
5.6.360.0120.01115.47
5.6.350.0120.01115.45
5.6.340.0120.01115.47
5.6.330.0120.01115.45
5.6.320.0120.01115.45
5.6.310.0120.01115.43
5.6.300.0120.01115.46
5.6.290.0120.01115.44
5.6.280.0120.01115.45
5.6.270.0120.01115.47
5.6.260.0120.01115.46
5.6.250.0120.01115.47
5.6.240.0120.01115.44
5.6.230.0120.01115.45
5.6.220.0120.01115.44
5.6.210.0120.01115.45
5.6.200.0120.01115.41
5.6.190.0120.01115.46
5.6.180.0120.01115.41
5.6.170.0120.01115.41
5.6.160.0120.01115.44
5.6.150.0120.01115.41
5.6.140.0120.01115.46
5.6.130.0120.01115.46
5.6.120.0120.01115.46
5.6.110.0120.01115.43
5.6.100.0120.01115.45
5.6.90.0120.01115.44
5.6.80.0120.01115.42
5.6.70.0120.01115.41
5.6.60.0120.01115.43
5.6.50.0120.01115.41
5.6.40.0120.01115.40
5.6.30.0120.01115.43
5.6.20.0120.01115.44
5.6.10.0120.01115.43
5.6.00.0120.01115.41
5.5.380.0120.01115.41
5.5.370.0120.01115.38
5.5.360.0120.01115.40
5.5.350.0120.01115.43
5.5.340.0120.01115.40
5.5.330.0120.01115.40
5.5.320.0120.01115.40
5.5.310.0120.01115.40
5.5.300.0120.01115.42
5.5.290.0120.01115.45
5.5.280.0120.01115.42
5.5.270.0120.01115.42
5.5.260.0120.01115.41
5.5.250.0120.01115.35
5.5.240.0120.01115.41
5.5.230.0120.01115.40
5.5.220.0120.01115.39
5.5.210.0120.01115.41
5.5.200.0120.01115.39
5.5.190.0120.01115.39
5.5.180.0120.01115.37
5.5.170.0120.01115.40
5.5.160.0120.01115.39
5.5.150.0120.01115.38
5.5.140.0120.01115.37
5.5.130.0120.01115.38
5.5.120.0120.01115.39
5.5.110.0120.01115.37
5.5.100.0120.01115.35
5.5.90.0120.01115.37
5.5.80.0120.01115.36
5.5.70.0120.01115.36
5.5.60.0120.01115.36
5.5.50.0120.01115.36
5.5.40.0120.01115.36
5.5.30.0120.01115.35
5.5.20.0120.01115.37
5.5.10.0120.01115.35
5.5.00.0120.01115.33
5.4.450.0090.00812.32
5.4.440.0090.00812.33
5.4.430.0090.00812.29
5.4.420.0090.00812.30
5.4.410.0090.00812.32
5.4.400.0090.00812.30
5.4.390.0090.00812.29
5.4.380.0090.00812.30
5.4.370.0090.00812.29
5.4.360.0090.00812.31
5.4.350.0090.00812.32
5.4.340.0090.00812.33
5.4.330.0090.00812.30
5.4.320.0090.00812.32
5.4.310.0090.00812.29
5.4.300.0090.00812.28
5.4.290.0090.00812.30
5.4.280.0090.00812.27
5.4.270.0090.00812.29
5.4.260.0090.00812.28
5.4.250.0090.00812.28
5.4.240.0090.00812.27
5.4.230.0090.00812.28
5.4.220.0090.00812.29
5.4.210.0090.00812.30
5.4.200.0090.00812.30
5.4.190.0090.00812.25
5.4.180.0090.00812.27
5.4.170.0090.00812.30
5.4.160.0090.00812.24
5.4.150.0090.00812.29
5.4.140.0090.00812.32
5.4.130.0090.00812.33
5.4.120.0090.00812.29
5.4.110.0090.00812.32
5.4.100.0090.00812.33
5.4.90.0090.00812.33
5.4.80.0090.00812.33
5.4.70.0090.00812.38
5.4.60.0090.00812.36
5.4.50.0090.00812.30
5.4.40.0090.00812.32
5.4.30.0090.00812.36
5.4.20.0090.00812.37
5.4.10.0090.00812.37
5.4.00.0090.00812.32

preferences:
42.47 ms | 401 KiB | 5 Q