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; }

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.0080.00814.86
7.4.0beta10.0090.00714.77
7.4.0alpha30.0090.00814.82
7.4.0alpha20.0090.00814.92
7.4.0alpha10.0090.00914.91
7.3.80.0080.00914.81
7.3.70.0080.00814.72
7.3.60.0080.00814.68
7.3.50.0080.00814.68
7.3.40.0080.00814.67
7.3.30.0080.00814.69
7.3.20.0180.00815.12
7.3.10.0160.00815.16
7.3.00.0170.00715.17
7.2.210.0090.00814.99
7.2.200.0090.00814.96
7.2.190.0090.00914.92
7.2.180.0080.00814.92
7.2.170.0090.00814.94
7.2.160.0080.00814.95
7.2.150.0150.00815.39
7.2.140.0170.00815.41
7.2.130.0150.00815.42
7.2.120.0150.00815.41
7.2.110.0160.00815.44
7.2.100.0160.00815.41
7.2.90.0140.00915.45
7.2.80.0150.00915.47
7.2.70.0150.00815.44
7.2.60.0140.00815.42
7.2.50.0140.00815.45
7.2.40.0170.00915.42
7.2.30.0140.00815.48
7.2.20.0160.00815.44
7.2.10.0140.00815.44
7.2.00.0170.00815.44
7.1.310.0150.00714.45
7.1.300.0140.00814.24
7.1.290.0130.00814.26
7.1.280.0140.00814.27
7.1.270.0130.00714.23
7.1.260.0150.00814.29
7.1.250.0130.00814.33
7.1.240.0190.00714.33
7.1.230.0180.00914.20
7.1.220.0210.00814.30
7.1.210.0170.01114.19
7.1.200.0220.00614.30
7.1.190.0260.00814.27
7.1.180.0510.01014.23
7.1.170.0160.00914.26
7.1.160.0190.00814.19
7.1.150.0160.01014.31
7.1.140.0160.00914.30
7.1.130.0170.00614.29
7.1.120.0170.01014.22
7.1.110.0220.00414.27
7.1.100.0160.01314.32
7.1.90.0180.00914.30
7.1.80.0090.01414.39
7.1.70.0230.01114.32
7.1.60.0170.00914.27
7.1.50.0200.00914.40
7.1.40.0920.00614.32
7.1.30.0180.00814.27
7.1.20.0160.00914.26
7.1.10.0180.00614.23
7.1.00.0160.00913.94
7.0.330.0160.00913.93
7.0.320.0150.01013.98
7.0.310.0190.01013.96
7.0.300.0230.00513.86
7.0.290.0170.01113.93
7.0.280.0170.00913.92
7.0.270.0190.00713.92
7.0.260.0140.01213.75
7.0.250.0180.00813.93
7.0.240.0190.01313.97
7.0.230.0160.00813.87
7.0.220.0160.00914.00
7.0.210.0170.01113.89
7.0.200.0170.00713.98
7.0.190.0180.00713.91
7.0.180.0170.00713.98
7.0.170.0140.01114.00
7.0.160.0150.00913.83
7.0.150.0170.00814.04
7.0.140.0480.01013.55
7.0.130.0220.01013.55
7.0.120.0160.01013.69
7.0.110.0180.00713.59
7.0.100.0170.00713.60
7.0.90.0160.00913.63
7.0.80.0180.00913.58
7.0.70.0200.00813.61
7.0.60.0170.00813.61
7.0.50.0200.00813.66
7.0.40.0170.00813.52
7.0.30.0170.01013.65
7.0.20.0160.00613.63
7.0.10.0150.00913.65
7.0.00.0150.01013.68
hhvm-3.22.00.1510.19190.66
hhvm-3.21.30.1500.19888.98
hhvm-3.21.00.1320.19289.17
hhvm-3.20.20.1440.19289.72
hhvm-3.19.20.1230.20488.87
hhvm-3.18.50.1260.20386.96
hhvm-3.18.40.1430.19287.29
hhvm-3.17.30.1110.17186.43
hhvm-3.15.40.1120.17284.28
hhvm-3.13.20.1290.17995.46
hhvm-3.12.140.1500.17194.27
hhvm-3.11.10.1370.16986.42
hhvm-3.10.10.1240.17283.50
5.6.400.0100.01114.41
5.6.390.0140.01314.29
5.6.380.0130.00914.35
5.6.370.0100.01614.36
5.6.360.0130.01214.48
5.6.350.0160.00814.52
5.6.340.0170.00914.36
5.6.330.0090.01514.33
5.6.320.0140.01114.33
5.6.310.0150.00914.38
5.6.300.0140.01014.37
5.6.290.0140.00814.32
5.6.280.0150.01014.31
5.6.270.0160.00914.35
5.6.260.0130.01314.25
5.6.250.0120.01014.36
5.6.240.0150.01114.44
5.6.230.0150.01014.30
5.6.220.0120.01114.34
5.6.210.0140.00814.35
5.6.200.0130.01114.33
5.6.190.0140.01014.33
5.6.180.0160.00914.41
5.6.170.0140.01114.27
5.6.160.0140.01114.42
5.6.150.0160.00614.48
5.6.140.0150.00914.42
5.6.130.0170.00714.35
5.6.120.0120.01014.32
5.6.110.0120.01114.31
5.6.100.0140.00814.31
5.6.90.0140.01214.17
5.6.80.0150.00914.28
5.6.70.0130.01214.31
5.6.60.0150.00814.16
5.6.50.0120.01114.34
5.6.40.0130.01014.22
5.6.30.0120.01214.20
5.6.20.0060.01614.35
5.6.10.0130.01014.23
5.6.00.0140.01014.32
5.5.380.0150.01114.25
5.5.370.0150.00814.33
5.5.360.0130.01214.27
5.5.350.0120.00814.19
5.5.340.0110.01414.48
5.5.330.0140.01014.41
5.5.320.0140.00714.40
5.5.310.0130.01114.23
5.5.300.0140.00814.39
5.5.290.0140.01214.44
5.5.280.0130.00914.34
5.5.270.0120.00914.18
5.5.260.0110.01514.18
5.5.250.0160.00814.34
5.5.240.0100.01514.29
5.5.230.0120.00814.07
5.5.220.0170.00714.24
5.5.210.0130.01214.26
5.5.200.0140.00914.10
5.5.190.0110.01114.25
5.5.180.0150.00914.25
5.5.170.0140.01014.17
5.5.160.0150.00914.40
5.5.150.0130.00914.16
5.5.140.0110.01014.25
5.5.130.0160.00714.14
5.5.120.0130.01114.17
5.5.110.0110.01214.27
5.5.100.0110.01114.28
5.5.90.0180.00814.21
5.5.80.0130.00814.27
5.5.70.0120.01114.25
5.5.60.0150.00714.12
5.5.50.0130.00914.06
5.5.40.0190.00614.00
5.5.30.0100.01114.09
5.5.20.0140.00714.17
5.5.10.0130.01014.23
5.5.00.0130.00914.18
5.4.450.0100.00811.35
5.4.440.0110.00611.33
5.4.430.0110.00611.33
5.4.420.0100.00711.31
5.4.410.0110.00911.30
5.4.400.0090.00911.29
5.4.390.0120.00611.27
5.4.380.0080.00711.26
5.4.370.0100.00511.34
5.4.360.0100.00611.25
5.4.350.0070.00811.28
5.4.340.0100.00711.30
5.4.330.0130.00311.26
5.4.320.0090.00811.32
5.4.310.0100.00611.30
5.4.300.0120.00511.32
5.4.290.0110.00611.24
5.4.280.0090.00911.28
5.4.270.0080.00811.25
5.4.260.0080.00911.31
5.4.250.0100.00511.28
5.4.240.0080.01011.28
5.4.230.0060.00911.27
5.4.220.0100.00711.24
5.4.210.0130.00611.27
5.4.200.0090.00711.30
5.4.190.0080.00911.30
5.4.180.0100.00711.23
5.4.170.0080.01111.32
5.4.160.0110.00811.25
5.4.150.0100.00811.30
5.4.140.0110.00811.25
5.4.130.0130.00611.34
5.4.120.0090.00811.27
5.4.110.0070.00811.32
5.4.100.0100.00711.33
5.4.90.0070.00811.29
5.4.80.0090.00911.27
5.4.70.0100.00611.30
5.4.60.0060.00911.25
5.4.50.0090.00811.28
5.4.40.0090.00811.25
5.4.30.0120.00411.31
5.4.20.0070.00711.32
5.4.10.0100.00711.33
5.4.00.0090.00711.32
5.3.290.0090.00711.22
5.3.280.0110.00511.16
5.3.270.0100.00611.21
5.3.260.0090.00711.16
5.3.250.0080.00911.22
5.3.240.0100.00611.19
5.3.230.0100.00611.20
5.3.220.0110.00611.11
5.3.210.0090.00811.17
5.3.200.0080.00811.11
5.3.190.0090.00611.15
5.3.180.0090.00811.21
5.3.170.0100.00711.17
5.3.160.0100.00611.15
5.3.150.0070.00811.17
5.3.140.0080.00911.20
5.3.130.0110.00411.19
5.3.120.0090.00611.19
5.3.110.0070.00911.20
5.3.100.0090.00711.20
5.3.90.0060.00811.16
5.3.80.0070.01011.17
5.3.70.0090.00611.18
5.3.60.0070.01011.17
5.3.50.0100.00511.18
5.3.40.0120.00311.19
5.3.30.0060.01111.19
5.3.20.0100.00711.20
5.3.10.0080.00711.16
5.3.00.0120.00511.09
5.2.170.0090.00610.98
5.2.160.0080.00610.99
5.2.150.0070.00711.00
5.2.140.0090.00510.97
5.2.130.0090.00610.97
5.2.120.0080.00410.95
5.2.110.0080.00710.97
5.2.100.0070.00610.98
5.2.90.0080.00410.97
5.2.80.0080.00510.96
5.2.70.0050.00710.97
5.2.60.0060.01010.95
5.2.50.0090.00510.96
5.2.40.0080.00710.98
5.2.30.0020.01010.96
5.2.20.0060.00610.95
5.2.10.0060.00910.95
5.2.00.0080.00510.95
5.1.60.0060.00510.95
5.1.50.0080.00610.95
5.1.40.0060.00610.95
5.1.30.0050.00810.95
5.1.20.0060.00610.95
5.1.10.0080.00610.95
5.1.00.0090.00510.95
5.0.50.0030.00810.95
5.0.40.0080.00610.95
5.0.30.0070.00610.95
5.0.20.0060.00710.95
5.0.10.0070.00510.95
5.0.00.0060.00710.95
4.4.90.0040.00810.95
4.4.80.0050.00810.95
4.4.70.0040.00810.95
4.4.60.0050.00510.95
4.4.50.0030.00910.95
4.4.40.0050.00810.95
4.4.30.0040.00710.95
4.4.20.0060.00610.95
4.4.10.0070.00510.95
4.4.00.0080.00410.95
4.3.110.0030.01010.95
4.3.100.0050.00710.95
4.3.90.0050.00710.95
4.3.80.0060.00710.95
4.3.70.0040.00610.95
4.3.60.0060.00610.95
4.3.50.0060.00410.95
4.3.40.0050.00710.95
4.3.30.0060.00810.95
4.3.20.0050.00610.95
4.3.10.0040.00710.95
4.3.00.0040.00710.95