3v4l.org

run code in 200+ php & hhvm versions
<?php generate(); // FUNCTION function generate() { $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY"; //now we generate a new random ID number using the substrings of the digitList string above for( $i = 0; $i < 100; $i++) { $three_chars = NULL; $three_chars .= substr( $digilist, rand( 1, 9 ), 1 ); $three_chars .= substr( $digilist, rand( 10, 31 ), 1 ); $three_chars .= substr( $digilist, rand( 10, 31 ), 1 ); if ($i < 10) { $three_chars .= '0'; $three_chars .= $i; } else { $three_chars .= $i; } $id = $three_chars; $key = get_key( $id ); echo $id . ":" . $key . "\n"; } } function get_key( $id ) { $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY"; //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); } } return $key; }
based on lLGja

Abusive script

This script was stopped while abusing our resources

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.4.0beta20.0110.00714.84
7.4.0beta10.0090.00714.75
7.4.0alpha30.0090.00814.82
7.4.0alpha20.0090.00814.93
7.4.0alpha10.0090.00814.91
7.3.80.0090.00814.83
7.3.70.0080.00814.71
7.3.60.0090.00814.72
7.3.50.0090.00814.71
7.3.40.0090.00714.70
7.3.30.0090.00814.71
7.3.20.0140.00815.11
7.3.10.0140.00815.11
7.3.00.0130.00815.13
7.2.210.0080.01015.03
7.2.200.0090.00914.97
7.2.190.0090.00914.95
7.2.180.0090.00914.97
7.2.170.0080.00914.98
7.2.160.0090.00814.93
7.2.150.0150.00915.38
7.2.140.0160.00815.34
7.2.130.0140.00915.36
7.2.120.0170.00815.36
7.2.110.0180.00815.39
7.2.100.0150.00815.36
7.2.90.0150.00815.41
7.2.80.0150.00815.38
7.2.70.0160.00815.42
7.2.60.0160.00815.42
7.2.50.0140.00915.40
7.2.40.0150.00915.43
7.2.30.0160.00915.46
7.2.20.0180.00915.41
7.2.10.0160.00815.37
7.2.00.0140.00815.39
7.1.310.0160.00814.30
7.1.300.0140.00814.18
7.1.290.0170.00714.25
7.1.280.0140.00814.23
7.1.270.0140.00714.24
7.1.260.0150.00714.24
7.1.250.0140.00814.26
7.1.240.0190.00914.35
7.1.230.0160.01014.40
7.1.220.0160.00914.38
7.1.210.0180.00814.36
7.1.200.0190.00814.40
7.1.190.0160.00914.37
7.1.180.0160.00914.33
7.1.170.0170.00914.37
7.1.160.0180.00814.35
7.1.150.0180.00914.40
7.1.140.0180.00814.38
7.1.130.0160.00814.39
7.1.120.0200.00914.34
7.1.110.0200.00914.41
7.1.100.0150.00814.39
7.1.90.0170.00914.41
7.1.80.0200.00914.38
7.1.70.0200.00814.40
7.1.60.0160.00714.42
7.1.50.0170.00914.43
7.1.40.0170.00814.41
7.1.30.0160.00914.38
7.1.20.0150.00814.41
7.1.10.0160.00814.33
7.1.00.0220.01014.37
7.0.330.0170.00814.01
7.0.320.0180.00813.99
7.0.310.0170.00814.06
7.0.300.0190.00814.00
7.0.290.0170.00914.08
7.0.280.0170.00914.06
7.0.270.0170.00914.06
7.0.260.0160.00913.99
7.0.250.0150.00914.10
7.0.240.0150.01014.10
7.0.230.0160.01014.10
7.0.220.0180.01014.10
7.0.210.0220.00914.03
7.0.200.0160.00814.06
7.0.190.0200.00814.09
7.0.180.0210.00814.05
7.0.170.0160.00814.14
7.0.160.0160.00814.09
7.0.150.0280.00814.02
7.0.140.0200.00914.02
7.0.130.0240.00914.05
7.0.120.0160.00813.96
7.0.110.0160.00913.90
7.0.100.0170.00813.95
7.0.90.0170.00913.99
7.0.80.0160.00813.95
7.0.70.0160.00913.95
7.0.60.0160.00813.99
7.0.50.0180.00814.02
7.0.40.0160.00814.02
7.0.30.0160.00814.04
7.0.20.0160.00913.90
7.0.10.0180.00914.00
7.0.00.0150.00813.89
hhvm-3.22.00.1320.18490.58
hhvm-3.21.30.1250.18988.20
hhvm-3.21.00.1360.19988.14
hhvm-3.20.20.1290.19988.89
hhvm-3.19.20.1340.19387.92
hhvm-3.18.50.1240.18786.62
hhvm-3.18.40.1330.19086.52
hhvm-3.17.30.1130.16785.65
hhvm-3.15.40.1190.16483.53
hhvm-3.13.20.1290.17994.69
hhvm-3.12.140.1370.18493.70
hhvm-3.11.10.1250.18385.51
hhvm-3.10.10.1210.18182.90
5.6.400.0140.00914.37
5.6.390.0120.01014.34
5.6.380.0130.00914.30
5.6.370.0130.01114.38
5.6.360.0130.01114.34
5.6.350.0130.01014.37
5.6.340.0130.01114.29
5.6.330.0120.01014.32
5.6.320.0130.01014.42
5.6.310.0130.01014.38
5.6.300.0140.01114.40
5.6.290.0150.01014.38
5.6.280.0140.00914.38
5.6.270.0130.01014.38
5.6.260.0130.01014.36
5.6.250.0120.01214.34
5.6.240.0130.01114.34
5.6.230.0140.01014.36
5.6.220.0120.01114.35
5.6.210.0130.01114.34
5.6.200.0120.01214.33
5.6.190.0130.01114.34
5.6.180.0140.00914.31
5.6.170.0140.01014.36
5.6.160.0110.01114.32
5.6.150.0120.01114.35
5.6.140.0140.00914.29
5.6.130.0130.00914.34
5.6.120.0130.01014.31
5.6.110.0140.00914.32
5.6.100.0120.01114.33
5.6.90.0140.00914.33
5.6.80.0130.01014.26
5.6.70.0130.00914.24
5.6.60.0130.01014.26
5.6.50.0140.00914.25
5.6.40.0130.01014.26
5.6.30.0130.01014.27
5.6.20.0110.01114.30
5.6.10.0130.01014.26
5.6.00.0120.01014.27
5.5.380.0140.01014.36
5.5.370.0140.01014.31
5.5.360.0150.00914.33
5.5.350.0130.01114.31
5.5.340.0130.00914.30
5.5.330.0130.01014.33
5.5.320.0140.01014.27
5.5.310.0130.00914.29
5.5.300.0130.01014.31
5.5.290.0130.01014.28
5.5.280.0140.00914.25
5.5.270.0140.01014.31
5.5.260.0130.01114.27
5.5.250.0130.01014.25
5.5.240.0120.01114.23
5.5.230.0130.01014.18
5.5.220.0130.00914.26
5.5.210.0130.01114.24
5.5.200.0120.01014.17
5.5.190.0130.01014.26
5.5.180.0140.00914.25
5.5.170.0140.01114.26
5.5.160.0120.01014.26
5.5.150.0120.01014.22
5.5.140.0130.01014.21
5.5.130.0120.00914.22
5.5.120.0130.00814.20
5.5.110.0120.01014.21
5.5.100.0110.01114.18
5.5.90.0130.01014.26
5.5.80.0110.01114.20
5.5.70.0150.00814.20
5.5.60.0130.00914.16
5.5.50.0140.00914.23
5.5.40.0120.01014.23
5.5.30.0110.01114.18
5.5.20.0110.01114.18
5.5.10.0130.00914.28
5.5.00.0140.00914.19
5.4.450.0100.00711.32
5.4.440.0100.00811.32
5.4.430.0110.00711.30
5.4.420.0100.00811.31
5.4.410.0090.00811.32
5.4.400.0110.00711.29
5.4.390.0110.00711.31
5.4.380.0110.00711.31
5.4.370.0100.00711.30
5.4.360.0100.00711.29
5.4.350.0090.00811.32
5.4.340.0100.00711.29
5.4.330.0100.00711.29
5.4.320.0090.00811.33
5.4.310.0100.00611.31
5.4.300.0100.00711.31
5.4.290.0090.00811.31
5.4.280.0100.00611.30
5.4.270.0110.00711.30
5.4.260.0090.00811.31
5.4.250.0100.00811.27
5.4.240.0100.00611.28
5.4.230.0110.00611.27
5.4.220.0100.00611.30
5.4.210.0090.00811.27
5.4.200.0090.00811.30
5.4.190.0100.00611.27
5.4.180.0100.00711.29
5.4.170.0100.00611.31
5.4.160.0090.00811.29
5.4.150.0080.00811.31
5.4.140.0100.00711.30
5.4.130.0090.00811.31
5.4.120.0090.00711.31
5.4.110.0100.00711.32
5.4.100.0100.00711.31
5.4.90.0100.00711.31
5.4.80.0100.00611.30
5.4.70.0100.00711.30
5.4.60.0090.00711.30
5.4.50.0090.00811.31
5.4.40.0090.00711.30
5.4.30.0100.00611.28
5.4.20.0100.00611.30
5.4.10.0090.00811.31
5.4.00.0110.00611.30
5.3.290.0090.00811.24
5.3.280.0090.00811.21
5.3.270.0090.00711.24
5.3.260.0090.00711.23
5.3.250.0080.00811.23
5.3.240.0090.00711.19
5.3.230.0090.00711.21
5.3.220.0090.00711.19
5.3.210.0100.00711.21
5.3.200.0090.00711.20
5.3.190.0090.00711.21
5.3.180.0100.00811.23
5.3.170.0100.00611.22
5.3.160.0100.00611.23
5.3.150.0100.00711.24
5.3.140.0080.00811.22
5.3.130.0100.00711.23
5.3.120.0080.00811.22
5.3.110.0100.00611.22
5.3.100.0100.00511.22
5.3.90.0080.00811.23
5.3.80.0100.00611.19
5.3.70.0080.00811.21
5.3.60.0100.00711.22
5.3.50.0080.00811.21
5.3.40.0090.00711.21
5.3.30.0090.00711.22
5.3.20.0080.00811.22
5.3.10.0100.00611.18
5.3.00.0080.00711.18
5.2.170.0070.00811.07
5.2.160.0070.00711.08
5.2.150.0080.00711.07
5.2.140.0070.00611.06
5.2.130.0070.00711.05
5.2.120.0080.00611.07
5.2.110.0080.00611.06
5.2.100.0070.00711.07
5.2.90.0060.00811.05
5.2.80.0080.00611.04
5.2.70.0090.00611.05
5.2.60.0080.00611.04
5.2.50.0070.00711.05
5.2.40.0090.00611.05
5.2.30.0070.00611.04
5.2.20.0090.00611.04
5.2.10.0080.00611.04
5.2.00.0070.00611.04
5.1.60.0060.00711.04
5.1.50.0070.00611.04
5.1.40.0070.00711.04
5.1.30.0060.00711.04
5.1.20.0070.00611.04
5.1.10.0070.00611.04
5.1.00.0070.00611.04
5.0.50.0060.00711.04
5.0.40.0050.00711.04
5.0.30.0070.00511.04
5.0.20.0060.00711.04
5.0.10.0060.00711.04
5.0.00.0070.00611.04
4.4.90.0050.00611.04
4.4.80.0040.00711.04
4.4.70.0040.00711.04
4.4.60.0050.00511.04
4.4.50.0050.00711.04
4.4.40.0040.00611.04
4.4.30.0040.00711.04
4.4.20.0050.00611.04
4.4.10.0050.00711.04
4.4.00.0050.00711.04
4.3.110.0050.00611.04
4.3.100.0040.00811.04
4.3.90.0050.00711.04
4.3.80.0050.00611.04
4.3.70.0040.00711.04
4.3.60.0050.00711.04
4.3.50.0040.00711.04
4.3.40.0060.00511.04
4.3.30.0050.00511.04
4.3.20.0050.00711.04
4.3.10.0040.00811.04
4.3.00.0040.00711.04