3v4l.org

run code in 300+ PHP versions simultaneously
<?php// EXAMPLE USAGE$array = generate();echo $array[0];echo "<br />";echo $array[1];// FUNCTIONfunction 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.3.60.0090.00616.50
8.3.50.0050.01421.08
8.3.40.0090.00618.59
8.3.30.0030.01718.46
8.3.20.0040.00420.38
8.3.10.0000.00923.56
8.3.00.0050.00317.68
8.2.180.0110.00425.92
8.2.170.0110.00422.96
8.2.160.0100.00720.39
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00417.63
8.2.110.0030.00622.21
8.2.100.0080.00317.93
8.2.90.0050.00318.88
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0000.00717.80
8.2.50.0040.00418.07
8.2.40.0050.00321.11
8.2.30.0000.00720.64
8.2.20.0000.00817.57
8.2.10.0030.00617.86
8.2.00.0000.00818.04
8.1.280.0140.00025.92
8.1.270.0090.00623.91
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0080.00023.83
8.1.230.0070.00717.58
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.11
8.1.190.0000.00817.00
8.1.180.0050.00318.10
8.1.170.0070.00320.29
8.1.160.0000.00721.95
8.1.150.0000.00818.71
8.1.140.0000.00819.46
8.1.130.0070.00017.54
8.1.120.0000.00717.23
8.1.110.0070.00017.30
8.1.100.0000.00717.24
8.1.90.0040.00417.25
8.1.80.0030.00517.34
8.1.70.0000.01017.24
8.1.60.0030.00517.39
8.1.50.0060.00317.29
8.1.40.0000.00717.42
8.1.30.0050.00317.51
8.1.20.0020.00517.43
8.1.10.0030.00517.43
8.1.00.0000.00717.39
8.0.300.0030.00718.78
8.0.290.0050.00316.75
8.0.280.0000.00718.45
8.0.270.0030.00317.13
8.0.260.0000.00617.06
8.0.250.0000.00716.77
8.0.240.0030.00316.86
8.0.230.0000.00716.83
8.0.220.0050.00216.78
8.0.210.0050.00216.71
8.0.200.0030.00316.73
8.0.190.0070.00016.90
8.0.180.0050.00216.81
8.0.170.0070.00016.67
8.0.160.0000.00816.78
8.0.150.0000.00716.63
8.0.140.0000.00716.74
8.0.130.0070.00013.45
8.0.120.0040.00416.72
8.0.110.0030.00516.66
8.0.100.0040.00416.67
8.0.90.0000.00716.74
8.0.80.0060.00416.80
8.0.70.0080.00016.74
8.0.60.0040.00416.64
8.0.50.0000.00716.82
8.0.30.0160.00316.94
8.0.20.0150.00517.40
8.0.10.0040.00416.90
8.0.00.0070.01116.63
7.4.330.0060.00015.08
7.4.320.0030.00316.39
7.4.300.0030.00316.47
7.4.290.0070.00016.41
7.4.280.0060.00616.51
7.4.270.0050.00316.47
7.4.260.0030.00316.35
7.4.250.0050.00216.43
7.4.240.0020.00516.39
7.4.230.0050.00216.52
7.4.220.0150.00316.47
7.4.210.0090.00616.40
7.4.200.0000.00616.36
7.4.160.0040.01116.46
7.4.150.0100.01017.40
7.4.140.0080.01017.86
7.4.130.0100.01216.38
7.4.120.0110.00716.48
7.4.110.0070.01016.46
7.4.100.0090.01616.34
7.4.90.0100.00716.41
7.4.80.0100.00719.39
7.4.70.0030.02016.43
7.4.60.0100.00716.35
7.4.50.0040.00416.38
7.4.40.0070.01016.47
7.4.30.0060.01616.50
7.4.00.0070.01014.62
7.3.330.0050.00012.91
7.3.320.0000.00513.09
7.3.310.0030.00316.24
7.3.300.0000.00716.00
7.3.290.0110.00716.15
7.3.280.0130.00816.16
7.3.270.0200.00017.40
7.3.260.0060.01016.39
7.3.250.0080.01116.28
7.3.240.0080.01016.31
7.3.230.0110.00716.39
7.3.210.0140.00716.45
7.3.200.0160.00016.21
7.3.190.0040.01416.43
7.3.180.0040.01416.31
7.3.170.0110.01116.45
7.3.160.0130.01016.39
7.3.00.0070.00716.34
7.2.330.0160.00016.39
7.2.320.0060.01516.39
7.2.310.0030.01416.61
7.2.300.0090.01216.41
7.2.290.0140.00316.21
7.2.130.0040.01116.88
7.2.120.0090.00616.80
7.2.110.0090.00316.88
7.2.100.0000.01016.42
7.2.90.0060.00616.82
7.2.80.0060.00616.59
7.2.70.0040.01116.71
7.2.60.0070.00516.79
7.2.50.0060.00916.67
7.2.40.0100.00616.52
7.2.30.0030.00916.86
7.2.20.0030.01216.77
7.2.10.0070.00716.82
7.2.00.0030.01118.05
7.1.250.0080.00315.64
7.1.240.0030.00615.27
7.1.230.0060.00915.70
7.1.220.0030.01015.68
7.1.210.0070.00715.75
7.1.200.0070.00315.51
7.1.190.0090.00315.62
7.1.180.0030.00915.42
7.1.170.0000.01415.62
7.1.160.0060.00615.48
7.1.150.0070.00715.55
7.1.140.0070.00715.71
7.1.130.0000.01315.44
7.1.120.0000.00715.72
7.1.110.0000.01315.85
7.1.100.0030.01516.87
7.1.90.0040.00415.72
7.1.80.0040.00715.45
7.1.70.0090.00516.28
7.1.60.0080.01017.65
7.1.50.0030.01116.23
7.1.40.0000.00915.78
7.1.30.0030.00915.48
7.1.20.0000.00715.68
7.1.10.0030.01015.25
7.1.00.0020.04518.92
7.0.330.0090.00015.17
7.0.320.0040.01115.31
7.0.310.0030.00714.93
7.0.300.0030.00615.46
7.0.290.0030.00715.07
7.0.280.0100.00314.99
7.0.270.0000.01215.08
7.0.260.0000.01015.12
7.0.250.0040.00415.33
7.0.240.0090.00614.96
7.0.230.0000.01315.29
7.0.220.0090.00315.43
7.0.210.0040.00815.41
7.0.200.0120.00715.91
7.0.190.0030.00915.26
7.0.180.0070.00715.32
7.0.170.0030.00715.47
7.0.160.0030.01015.10
7.0.150.0030.00715.47
7.0.140.0030.01315.54
7.0.130.0070.00715.20
7.0.120.0030.00915.19
7.0.110.0040.00815.34
7.0.100.0160.02418.46
7.0.90.0020.03518.57
7.0.80.0060.04518.46
7.0.70.0080.04118.37
7.0.60.0030.04318.43
7.0.50.0090.04118.54
7.0.40.0050.04416.63
7.0.30.0090.03116.70
7.0.20.0030.04716.66
7.0.10.0020.04716.79
7.0.00.0130.04016.72
5.6.380.0000.01714.00
5.6.370.0100.00314.43
5.6.360.0030.00714.19
5.6.350.0040.01114.39
5.6.340.0090.00314.38
5.6.330.0030.01314.21
5.6.320.0000.01114.42
5.6.310.0000.01014.36
5.6.300.0000.00714.24
5.6.290.0030.00713.99
5.6.280.0050.02117.73
5.6.270.0040.00414.32
5.6.260.0070.00314.13
5.6.250.0090.03617.46
5.6.240.0100.03717.39
5.6.230.0060.04617.31
5.6.220.0030.04717.36
5.6.210.0030.04617.39
5.6.200.0070.03117.52
5.6.190.0110.04017.57
5.6.180.0080.02317.46
5.6.170.0100.04117.50
5.6.160.0050.04117.53
5.6.150.0080.04017.52
5.6.140.0050.04717.46
5.6.130.0070.04317.71
5.6.120.0050.04517.46
5.6.110.0050.04517.65
5.6.100.0030.04717.40
5.6.90.0080.04417.46
5.6.80.0070.02717.17
5.6.70.0060.03517.27
5.6.60.0020.04717.27
5.6.50.0090.03917.24
5.6.40.0100.02617.22
5.6.30.0130.03817.19
5.6.20.0050.03517.11
5.6.10.0080.04217.17
5.6.00.0070.04317.19
5.5.380.0100.02715.78
5.5.370.0050.03515.68
5.5.360.0070.04015.70
5.5.350.0030.03015.73
5.5.340.0030.04016.00
5.5.330.0080.04115.96
5.5.320.0060.02615.95
5.5.310.0060.04315.94
5.5.300.0030.04815.96
5.5.290.0110.01815.89
5.5.280.0030.04915.96
5.5.270.0080.03815.88
5.5.260.0040.04515.88
5.5.250.0030.04715.79
5.5.240.0100.03515.59
5.5.230.0050.04015.61
5.5.220.0050.04215.64
5.5.210.0070.03015.63
5.5.200.0090.03315.64
5.5.190.0070.04315.55
5.5.180.0070.04215.56
5.5.170.0000.01011.06
5.5.160.0120.03515.58
5.5.150.0050.04315.59
5.5.140.0070.03315.59
5.5.130.0040.02315.59
5.5.120.0050.04215.54
5.5.110.0070.04315.62
5.5.100.0050.04415.54
5.5.90.0030.02615.57
5.5.80.0040.03815.56
5.5.70.0120.03915.56
5.5.60.0100.03715.52
5.5.50.0100.03515.56
5.5.40.0070.04015.54
5.5.30.0070.03815.54
5.5.20.0050.03315.55
5.5.10.0070.04015.53
5.5.00.0070.03715.48
5.4.450.0020.03015.10
5.4.440.0070.04415.19
5.4.430.0020.04615.27
5.4.420.0020.04015.24
5.4.410.0060.04215.20
5.4.400.0070.03815.08
5.4.390.0080.03715.09
5.4.380.0050.04015.08
5.4.370.0060.03615.02
5.4.360.0070.04315.03
5.4.350.0050.04315.05
5.4.340.0130.03814.94
5.4.330.0060.00311.06
5.4.320.0070.03615.04
5.4.310.0070.04015.09
5.4.300.0060.02815.09
5.4.290.0040.03815.12
5.4.280.0020.03015.13
5.4.270.0050.02515.05
5.4.260.0090.02715.08
5.4.250.0030.04314.93
5.4.240.0040.03714.94
5.4.230.0050.04215.10
5.4.220.0070.04315.06
5.4.210.0090.03514.98
5.4.200.0030.03914.94
5.4.190.0030.04114.93
5.4.180.0000.04814.93
5.4.170.0060.04314.97
5.4.160.0110.03014.97
5.4.150.0050.04315.03
5.4.140.0080.03513.67
5.4.130.0080.02813.67
5.4.120.0060.03113.66
5.4.110.0140.03613.64
5.4.100.0060.02613.68
5.4.90.0070.03613.70
5.4.80.0070.03213.72
5.4.70.0030.04113.72
5.4.60.0050.03813.63
5.4.50.0110.03313.63
5.4.40.0060.03513.71
5.4.30.0020.02513.69
5.4.20.0060.03813.64
5.4.10.0080.03113.67
5.4.00.0100.03513.37
5.3.290.0030.04312.86
5.3.280.0070.03812.80
5.3.270.0090.03312.80
5.3.260.0030.04212.76
5.3.250.0050.04312.83
5.3.240.0070.04212.76
5.3.230.0050.02812.81
5.3.220.0090.03412.78
5.3.210.0040.04412.74
5.3.200.0070.03612.79
5.3.190.0050.04012.74
5.3.180.0070.03712.79
5.3.170.0030.04112.72
5.3.160.0030.03312.74
5.3.150.0030.02012.80
5.3.140.0030.03012.81
5.3.130.0000.02712.78
5.3.120.0030.02112.76
5.3.110.0060.03912.79
5.3.100.0070.03712.54
5.3.90.0090.03912.49
5.3.80.0080.02512.49
5.3.70.0060.03912.52
5.3.60.0070.03812.46
5.3.50.0050.04212.45
5.3.40.0050.04212.43
5.3.30.0080.03912.41
5.3.20.0030.04012.38
5.3.10.0080.04012.35
5.3.00.0030.03812.35
5.2.170.0090.03211.13
5.2.160.0030.03411.13
5.2.150.0020.02711.02
5.2.140.0070.03311.02
5.2.130.0030.03411.00
5.2.120.0030.03611.07
5.2.110.0030.03611.07
5.2.100.0030.03611.00
5.2.90.0060.03211.04
5.2.80.0080.03011.11
5.2.70.0020.03310.97
5.2.60.0030.02811.02
5.2.50.0050.03110.95
5.2.40.0030.02210.95
5.2.30.0000.03511.04
5.2.20.0040.01511.00
5.2.10.0030.02310.92
5.2.00.0030.02210.90
5.1.60.0050.02710.52
5.1.50.0060.02710.52
5.1.40.0060.02110.52
5.1.30.0070.02710.72
5.1.20.0020.03210.69
5.1.10.0050.03010.56
5.1.00.0070.02710.59
5.0.50.0000.0299.84
5.0.40.0030.0219.73
5.0.30.0020.0369.66
5.0.20.0000.0269.66
5.0.10.0020.0259.54
5.0.00.0020.0359.67
4.4.90.0000.0199.32
4.4.80.0030.0139.32
4.4.70.0000.0179.32
4.4.60.0010.0209.32
4.4.50.0030.0209.32
4.4.40.0020.0289.32
4.4.30.0020.0209.32
4.4.20.0020.0229.32
4.4.10.0000.0179.32
4.4.00.0020.0199.32
4.3.110.0000.0219.32
4.3.100.0020.0199.32
4.3.90.0030.0129.32
4.3.80.0020.0209.32
4.3.70.0000.0219.32
4.3.60.0060.0139.32
4.3.50.0010.0139.32
4.3.40.0030.0289.32
4.3.30.0010.0209.32
4.3.20.0000.0179.32
4.3.10.0000.0189.32
4.3.00.0000.0169.32

preferences:
62.09 ms | 401 KiB | 5 Q