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(9, 9), 1); //random number $id .= substr($digilist, rand(21, 21), 1); //then a letter $id .= substr($digilist, rand(13, 13), 1); //another letter $id .= substr($digilist, rand(2, 9), 1); //a number $id .= substr($digilist, rand(6, 6), 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)
7.4.00.0060.01214.93
7.3.120.0120.00314.86
7.3.110.0080.00614.98
7.3.100.0100.00514.53
7.3.90.0090.00714.83
7.3.80.0030.01114.81
7.3.70.0050.00814.94
7.3.60.0040.00814.90
7.3.50.0010.01214.89
7.3.40.0070.00714.61
7.3.30.0060.00714.92
7.3.20.0060.00616.66
7.3.10.0050.00816.85
7.3.00.0090.00516.63
7.2.250.0060.01314.89
7.2.240.0050.01215.17
7.2.230.0080.01015.16
7.2.220.0060.00514.88
7.2.210.0040.00915.01
7.2.200.0030.01015.29
7.2.190.0040.00815.13
7.2.180.0070.00614.81
7.2.170.0070.00914.96
7.2.160.0000.01415.03
7.2.150.0060.00616.91
7.2.140.0080.00817.09
7.2.130.0100.00316.93
7.2.120.0090.00316.80
7.2.110.0030.01317.00
7.2.100.0090.00617.12
7.2.90.0040.01417.15
7.2.80.0000.01416.85
7.2.70.0030.01017.07
7.2.60.0040.01216.95
7.2.50.0000.01516.95
7.2.40.0030.00916.79
7.2.30.0080.00616.70
7.2.20.0030.01317.08
7.2.10.0070.00716.93
7.2.00.0070.00718.19
7.1.330.0050.01115.87
7.1.320.0030.01115.76
7.1.310.0090.00415.87
7.1.300.0050.00615.69
7.1.290.0080.00515.87
7.1.280.0060.00615.81
7.1.270.0020.01315.91
7.1.260.0060.00815.71
7.1.250.0000.01215.83
7.1.100.0110.00017.88
7.1.70.0060.00617.27
7.1.60.0220.01135.16
7.1.50.0200.00734.86
7.1.40.0190.01234.65
7.1.30.0060.02234.50
7.1.20.0160.01234.45
7.1.10.0030.00916.52
7.1.00.0030.01016.72
7.0.200.0070.00716.78
7.0.190.0030.00916.82
7.0.180.0000.01416.20
7.0.170.0070.00716.18
7.0.160.0060.00616.49
7.0.150.0060.00616.52
7.0.140.0030.00916.28
7.0.130.0070.00716.47
7.0.120.0070.00716.44
7.0.110.0030.01016.26
7.0.100.0000.01416.38
7.0.90.0040.01116.22
7.0.80.0030.00916.33
7.0.70.0000.01316.38
7.0.60.0030.01016.17
7.0.50.0000.01316.39
7.0.40.0030.01016.38
7.0.30.0040.00916.24
7.0.20.0030.01016.38
7.0.10.0060.00616.31
7.0.00.0040.00816.58

preferences:
34.27 ms | 400 KiB | 5 Q