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 C1DIs

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.01214.52
7.4.0beta10.0100.00914.74
7.4.0alpha30.0110.00714.80
7.4.0alpha20.0090.00814.89
7.4.0alpha10.0130.00714.89
7.3.80.0080.00914.74
7.3.70.0080.01014.66
7.3.60.0090.01014.67
7.3.50.0090.00714.68
7.3.40.0110.00614.67
7.3.30.0110.00714.74
7.3.20.0140.00815.23
7.3.10.0140.00715.20
7.3.00.0160.00915.12
7.2.210.0080.00914.97
7.2.200.0090.00914.98
7.2.190.0090.00914.89
7.2.180.0130.00614.93
7.2.170.0100.00814.93
7.2.160.0110.00614.93
7.2.150.0200.00815.35
7.2.140.0150.00615.45
7.2.130.0190.00715.39
7.2.120.0140.00715.45
7.2.110.0130.00815.49
7.2.100.0110.01115.42
7.2.90.0130.00815.49
7.2.80.0160.00715.46
7.2.70.0150.00915.48
7.2.60.0180.00815.46
7.2.50.0130.01015.49
7.2.40.0120.01115.43
7.2.30.0110.01015.45
7.2.20.0120.00915.41
7.2.10.0120.00915.46
7.2.00.0140.00715.45
7.1.310.0130.00715.14
7.1.300.0130.00814.20
7.1.290.0130.00814.33
7.1.280.0130.00714.32
7.1.270.0170.01014.26
7.1.260.0230.00914.30
7.1.250.0140.00614.30
7.1.240.0190.01313.84
7.1.230.0330.00013.95
7.1.220.0190.00813.96
7.1.210.0290.00413.96
7.1.200.0280.00814.16
7.1.190.0150.01513.80
7.1.180.0610.00414.09
7.1.170.0270.00813.87
7.1.160.0290.00314.14
7.1.150.0250.00313.91
7.1.140.0190.01013.73
7.1.130.0180.01113.78
7.1.120.0220.00814.03
7.1.110.0170.00713.76
7.1.100.0080.01613.66
7.1.90.0150.01214.16
7.1.80.0250.01313.71
7.1.70.0120.01514.00
7.1.60.0150.00813.84
7.1.50.0300.00313.82
7.1.40.3090.00713.98
7.1.30.0170.01013.83
7.1.20.0220.00914.00
7.1.10.0180.01114.05
7.1.00.0220.00614.10
7.0.330.0130.01313.63
7.0.320.0180.01013.55
7.0.310.0170.00813.65
7.0.300.0280.00313.68
7.0.290.0280.00313.65
7.0.280.0220.01113.47
7.0.270.0180.00713.41
7.0.260.0210.00313.43
7.0.250.0210.00813.55
7.0.240.0220.00713.64
7.0.230.0180.00913.64
7.0.220.0230.00813.41
7.0.210.0230.00013.34
7.0.200.0260.00013.69
7.0.190.0140.01113.48
7.0.180.0140.01013.61
7.0.170.0130.01113.75
7.0.160.0140.01413.74
7.0.150.0120.00913.59
7.0.140.0160.01013.67
7.0.130.0160.01313.75
7.0.120.0190.00913.66
7.0.110.0270.00713.63
7.0.100.0130.01813.82
7.0.90.0220.00713.41
7.0.80.0170.01013.28
7.0.70.0130.01313.40
7.0.60.0190.00713.66
7.0.50.0160.01013.71
7.0.40.0190.00813.52
7.0.30.0130.01013.66
7.0.20.0180.01113.70
7.0.10.0140.00813.68
7.0.00.0080.01313.56
hhvm-3.22.00.1700.18390.80
hhvm-3.21.30.1440.20890.50
hhvm-3.21.00.1280.18590.63
hhvm-3.20.20.1300.20190.69
hhvm-3.19.20.1430.18590.25
hhvm-3.18.50.1630.17389.28
hhvm-3.18.40.1450.18188.34
hhvm-3.17.30.1070.18587.67
hhvm-3.15.40.1080.14585.41
hhvm-3.13.20.1450.17096.63
hhvm-3.12.140.1870.16795.30
hhvm-3.11.10.1570.15187.63
hhvm-3.10.10.1360.16184.30
5.6.400.0170.01414.30
5.6.390.0080.01514.61
5.6.380.0190.00514.63
5.6.370.0180.00614.17
5.6.360.0130.00814.25
5.6.350.0150.00814.38
5.6.340.0170.00814.13
5.6.330.0150.00514.02
5.6.320.0160.00614.21
5.6.310.0150.00914.16
5.6.300.0210.00514.38
5.6.290.0120.01214.33
5.6.280.0190.01014.13
5.6.270.0130.01314.14
5.6.260.0130.00914.49
5.6.250.0150.00514.34
5.6.240.0110.01614.25
5.6.230.0040.01914.33
5.6.220.0130.00714.26
5.6.210.0190.00814.32
5.6.200.0180.00614.42
5.6.190.0090.00914.06
5.6.180.0170.00514.34
5.6.170.0140.01014.10
5.6.160.0110.00514.08
5.6.150.0080.00814.41
5.6.140.0070.01814.45
5.6.130.0180.00614.45
5.6.120.0150.00314.25
5.6.110.0110.01514.09
5.6.100.0220.00014.38
5.6.90.0190.00314.57
5.6.80.0130.00913.98
5.6.70.0150.01114.03
5.6.60.0150.00614.18
5.6.50.0180.00814.12
5.6.40.0140.00714.29
5.6.30.0130.01014.00
5.6.20.0200.00814.18
5.6.10.0180.00614.15
5.6.00.0140.00814.27
5.5.380.0120.00914.42
5.5.370.0150.01214.04
5.5.360.0150.00614.32
5.5.350.0130.00714.18
5.5.340.0070.01714.14
5.5.330.0150.00414.19
5.5.320.0100.00814.38
5.5.310.0090.01414.28
5.5.300.0170.00514.50
5.5.290.0150.00214.05
5.5.280.0140.00614.28
5.5.270.0110.01114.12
5.5.260.0200.00714.32
5.5.250.0000.01614.34
5.5.240.0080.01214.21
5.5.230.0140.01314.35
5.5.220.0160.01314.00
5.5.210.0080.01614.38
5.5.200.0100.01414.26
5.5.190.0080.01514.27
5.5.180.0110.01114.39
5.5.170.0090.01813.87
5.5.160.0160.00714.36
5.5.150.0080.01214.15
5.5.140.0070.01114.36
5.5.130.0120.00914.51
5.5.120.0140.01114.25
5.5.110.0120.00614.36
5.5.100.0140.00814.15
5.5.90.0110.01114.21
5.5.80.0060.01213.99
5.5.70.0170.00814.21
5.5.60.0060.01613.97
5.5.50.0070.01314.28
5.5.40.0050.01114.45
5.5.30.0110.00614.35
5.5.20.0140.00314.41
5.5.10.0070.01213.79
5.5.00.0140.00613.97
5.4.450.0080.00811.34
5.4.440.0120.00511.34
5.4.430.0110.00711.34
5.4.420.0130.00311.34
5.4.410.0130.00511.40
5.4.400.0130.00711.49
5.4.390.0120.00411.34
5.4.380.0090.00911.34
5.4.370.0080.00811.43
5.4.360.0170.00011.34
5.4.350.0100.00311.34
5.4.340.0060.01211.34
5.4.330.0100.00711.34
5.4.320.0070.00911.34
5.4.310.0130.00611.34
5.4.300.0060.01111.34
5.4.290.0130.00011.34
5.4.280.0050.00811.34
5.4.270.0110.00611.34
5.4.260.0120.00311.34
5.4.250.0090.00611.36
5.4.240.0120.00611.34
5.4.230.0070.01111.34
5.4.220.0130.00211.34
5.4.210.0080.00411.40
5.4.200.0090.00611.41
5.4.190.0000.01411.34
5.4.180.0120.00411.34
5.4.170.0110.00611.34
5.4.160.0050.01011.34
5.4.150.0130.00011.34
5.4.140.0170.00011.39
5.4.130.0120.00311.34
5.4.120.0080.00411.34
5.4.110.0060.01111.34
5.4.100.0050.00811.34
5.4.90.0060.00611.34
5.4.80.0000.01511.37
5.4.70.0040.01111.34
5.4.60.0110.00711.34
5.4.50.0070.00711.34
5.4.40.0150.00911.34
5.4.30.0130.00311.34
5.4.20.0140.00311.34
5.4.10.0100.01011.34
5.4.00.0090.00311.34
5.3.290.0130.00411.34
5.3.280.0110.00411.34
5.3.270.0070.00711.34
5.3.260.0120.00311.34
5.3.250.0130.00011.34
5.3.240.0160.00011.34
5.3.230.0090.00211.34
5.3.220.0060.00611.34
5.3.210.0080.00811.34
5.3.200.0140.00311.34
5.3.190.0070.00511.34
5.3.180.0100.00611.34
5.3.170.0100.00311.34
5.3.160.0130.00711.34
5.3.150.0110.00611.34
5.3.140.0040.01511.34
5.3.130.0050.00511.34
5.3.120.0100.00711.34
5.3.110.0060.01211.34
5.3.100.0060.00611.34
5.3.90.0070.00711.34
5.3.80.0100.01011.34
5.3.70.0110.00911.34
5.3.60.0030.01511.34
5.3.50.0090.00911.34
5.3.40.0100.00511.34
5.3.30.0050.00911.34
5.3.20.0050.01111.34
5.3.10.0030.01011.34
5.3.00.0080.00311.34
5.2.170.0130.00011.34
5.2.160.0000.01311.34
5.2.150.0000.01011.34
5.2.140.0060.00611.34
5.2.130.0060.00611.34
5.2.120.0000.01211.34
5.2.110.0070.00711.34
5.2.100.0050.00811.34
5.2.90.0060.00611.34
5.2.80.0030.01011.34
5.2.70.0140.00611.34
5.2.60.0090.00311.34
5.2.50.0090.00311.34
5.2.40.0160.00011.34
5.2.30.0080.00411.34
5.2.20.0120.00411.34
5.2.10.0070.00411.34
5.2.00.0020.00711.34
5.1.60.0040.01111.34
5.1.50.0030.00711.34
5.1.40.0040.01211.34
5.1.30.0050.00511.34
5.1.20.0040.00811.34
5.1.10.0080.00311.34
5.1.00.0100.00211.34
5.0.50.0090.00211.34
5.0.40.0050.01011.34
5.0.30.0090.00011.34
5.0.20.0050.01011.34
5.0.10.0060.00911.34
5.0.00.0080.00511.34
4.4.90.0030.00711.34
4.4.80.0030.00911.34
4.4.70.0040.00911.34
4.4.60.0100.00011.34
4.4.50.0060.00611.34
4.4.40.0030.00611.34
4.4.30.0070.00711.34
4.4.20.0030.00611.34
4.4.10.0030.00911.34
4.4.00.0100.00011.34
4.3.110.0000.01211.34
4.3.100.0120.00011.34
4.3.90.0030.01111.34
4.3.80.0000.00911.34
4.3.70.0050.00511.34
4.3.60.0070.00211.34
4.3.50.0050.00311.34
4.3.40.0060.00311.34
4.3.30.0040.00711.34
4.3.20.0060.01011.34
4.3.10.0080.00611.34
4.3.00.0050.00511.34