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 $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 ); for( $i = 22; $i < 100; $i++) { $id = $three_chars . $i; $key = get_key( $id ); echo $id . "<br />" . $key . "<br />" . "-------------------------------------" . "<br />"; } } 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 NTK79

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.0alpha20.0100.00915.09
7.4.0alpha10.0110.00814.99
7.3.70.0100.00914.74
7.3.60.0120.00614.78
7.3.50.0090.01014.76
7.3.40.0110.00814.78
7.3.30.0090.00914.74
7.3.20.0130.00515.55
7.3.10.0180.00715.60
7.3.00.0150.00815.60
7.2.200.0100.00815.01
7.2.190.0090.01114.98
7.2.180.0120.00815.02
7.2.170.0100.00815.05
7.2.160.0080.00914.95
7.2.150.0170.00815.86
7.2.140.0160.00715.92
7.2.130.0170.00715.90
7.2.120.0130.00915.85
7.2.110.0180.00815.92
7.2.100.0140.01015.85
7.2.90.0230.01015.85
7.2.80.0280.00915.79
7.2.70.0200.00815.88
7.2.60.0190.01015.86
7.2.50.0260.01115.91
7.2.40.0210.00915.83
7.2.30.0200.01115.81
7.2.20.0210.00915.88
7.2.10.0210.00915.86
7.2.00.0210.00915.88
7.1.300.0130.00714.67
7.1.290.0270.00814.65
7.1.280.0130.00814.62
7.1.270.0120.00814.70
7.1.260.0140.00814.77
7.1.250.0140.00814.73
7.1.240.0190.00914.68
7.1.230.0200.00914.77
7.1.220.0260.00814.68
7.1.210.0230.01014.62
7.1.200.0240.00914.67
7.1.190.0230.00914.64
7.1.180.0230.00914.65
7.1.170.0200.00914.65
7.1.160.0200.00714.59
7.1.150.0260.01014.68
7.1.140.0210.01014.67
7.1.130.0260.00814.65
7.1.120.0260.00714.66
7.1.110.0220.00814.71
7.1.100.0200.00914.74
7.1.90.0260.00814.66
7.1.80.0220.01014.64
7.1.70.0240.00914.70
7.1.60.0250.00915.58
7.1.50.0250.01015.62
7.1.40.0250.00815.56
7.1.30.0270.00915.65
7.1.20.0240.00915.57
7.1.10.0290.00814.64
7.1.00.0230.00714.67
7.0.330.0200.00714.29
7.0.320.0380.01113.67
7.0.310.1290.00613.65
7.0.300.0630.00713.65
7.0.290.0340.00913.77
7.0.280.0560.00513.46
7.0.270.0280.00913.67
7.0.260.0190.00513.63
7.0.250.0340.01013.80
7.0.240.0370.01013.49
7.0.230.1170.00413.72
7.0.220.0380.00713.50
7.0.210.0320.01013.55
7.0.200.0230.00613.57
7.0.190.0210.01213.71
7.0.180.0310.00513.61
7.0.170.0280.01013.70
7.0.160.0330.00813.48
7.0.150.0360.00513.65
7.0.140.0350.01113.52
7.0.130.0260.01113.76
7.0.120.0220.00513.57
7.0.110.0290.00513.72
7.0.100.0260.00513.79
7.0.90.0290.00913.80
7.0.80.0220.00913.58
7.0.70.0300.00313.71
7.0.60.0310.01313.68
7.0.50.0280.00913.69
7.0.40.0290.01013.83
7.0.30.0310.00713.73
7.0.20.0240.01413.75
7.0.10.0260.01013.70
7.0.00.0260.00413.75
hhvm-3.22.00.1370.17590.73
hhvm-3.21.30.1230.18288.49
hhvm-3.21.00.1250.17890.48
hhvm-3.20.20.1050.17690.32
hhvm-3.19.20.1160.17989.58
hhvm-3.18.50.1110.17486.56
hhvm-3.18.40.1040.16788.68
hhvm-3.17.30.1130.15687.75
hhvm-3.15.40.1240.14285.54
hhvm-3.13.20.1140.18196.53
hhvm-3.12.140.1410.16795.51
hhvm-3.11.10.1050.15487.65
hhvm-3.10.10.1110.14584.47
5.6.400.0120.01114.33
5.6.390.0130.01114.35
5.6.380.0150.00914.25
5.6.370.0190.00814.40
5.6.360.0120.01414.53
5.6.350.0170.01314.38
5.6.340.0140.01014.22
5.6.330.0110.01314.35
5.6.320.0150.00614.61
5.6.310.0130.01214.52
5.6.300.0170.00514.31
5.6.290.0170.01114.33
5.6.280.0160.00914.30
5.6.270.0100.01414.45
5.6.260.0070.01414.45
5.6.250.0260.00514.28
5.6.240.0150.01414.36
5.6.230.0090.01214.38
5.6.220.0140.01314.46
5.6.210.0190.01014.47
5.6.200.0110.00914.43
5.6.190.0170.01114.56
5.6.180.0180.01214.32
5.6.170.0170.01214.30
5.6.160.0110.01314.13
5.6.150.0140.01214.29
5.6.140.0110.01114.43
5.6.130.0200.00814.44
5.6.120.0170.00814.19
5.6.110.0140.00814.22
5.6.100.0120.01314.25
5.6.90.0150.01314.24
5.6.80.0090.01214.27
5.6.70.0230.01014.46
5.6.60.0150.00514.37
5.6.50.0150.01114.32
5.6.40.0160.00714.27
5.6.30.0120.00714.29
5.6.20.0120.01214.23
5.6.10.0180.01214.32
5.6.00.0170.01114.17
5.5.380.0180.00612.76
5.5.370.0120.01312.85
5.5.360.0070.01012.88
5.5.350.0130.00712.75
5.5.340.0160.00712.72
5.5.330.0090.01112.76
5.5.320.0090.00912.36
5.5.310.0120.00912.97
5.5.300.0130.01112.97
5.5.290.0170.00212.90
5.5.280.0130.00912.69
5.5.270.0100.00712.82
5.5.260.0170.00612.64
5.5.250.0130.01012.88
5.5.240.0100.00912.63
5.5.230.0140.00512.66
5.5.220.0160.00712.63
5.5.210.0120.00912.81
5.5.200.0120.00512.68
5.5.190.0100.01011.25
5.5.180.0140.00811.00
5.5.170.0120.00411.41
5.5.160.0140.00311.33
5.5.150.0050.01411.33
5.5.140.0090.01011.24
5.5.130.0110.01111.16
5.4.450.0070.01011.27
5.4.440.0050.01211.26
5.4.430.0110.00311.11
5.4.420.0100.00711.17
5.4.410.0080.01011.27
5.4.400.0150.00410.93
5.4.390.0070.01210.99
5.4.380.0150.00211.16
5.4.370.0090.00911.07
5.4.360.0130.00311.20
5.4.350.0050.00911.10
5.4.340.0130.00611.31
5.4.330.0030.00811.16
5.4.320.0180.00411.36
5.4.310.0090.00911.18
5.4.300.0100.01711.12
5.3.290.0110.00710.78