3v4l.org

run code in 300+ PHP versions simultaneously
<?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).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.30.0100.02022.96
8.3.20.0130.01024.53
8.3.10.0110.01024.12
8.3.00.0100.00823.63
8.2.160.0190.00822.96
8.2.150.0200.00822.83
8.2.140.0100.00923.28
8.2.130.0100.00824.38
8.2.120.0110.00723.63
8.2.110.0100.00822.86
8.2.100.0140.00722.45
8.2.90.0140.00622.30
8.2.80.0120.00822.37
8.2.70.0160.00822.24
8.2.60.0100.00822.28
8.2.50.0140.00722.54
8.2.40.0120.00522.44
8.2.30.0100.00722.23
8.2.20.0120.00622.23
8.2.10.0130.00622.30
8.2.00.0110.00722.35
8.1.270.0070.01023.97
8.1.260.0070.00924.87
8.1.250.0100.00624.89
8.1.240.0140.00522.11
8.1.230.0140.00722.14
8.1.220.0100.00722.28
8.1.210.0100.00622.60
8.1.200.0110.00722.18
8.1.190.0120.00822.10
8.1.180.0140.00722.04
8.1.170.0100.00722.20
8.1.160.0110.00722.19
8.1.150.0080.00722.69
8.1.140.0110.00722.09
8.1.130.0120.00622.20
8.1.120.0100.00722.16
8.1.110.0130.00421.99
8.1.100.0100.00722.13
8.1.90.0110.00622.16
8.1.80.0110.00822.45
8.1.70.0120.00622.16
8.1.60.0140.00622.21
8.1.50.0120.00621.97
8.1.40.0100.00522.09
8.1.30.0100.00622.31
8.1.20.0150.00622.41
8.1.10.0150.00621.97
8.1.00.0120.00522.07
8.0.300.0110.00721.69
8.0.290.0160.00621.22
8.0.280.0160.00821.24
8.0.270.0080.01021.74
8.0.260.0140.00621.30
8.0.250.0090.00721.62
8.0.240.0160.00521.30
8.0.230.0150.00521.37
8.0.220.0140.00321.28
8.0.210.0170.00621.23
8.0.200.0100.00721.31
8.0.190.0150.00721.34
8.0.180.0110.00521.62
8.0.170.0150.00621.29
8.0.160.0090.00821.77
8.0.150.0160.00621.24
8.0.140.0160.00521.26
8.0.130.0150.00821.33
8.0.120.0190.00521.20
8.0.110.0110.00521.76
8.0.100.0130.00821.25
8.0.90.0140.00721.20
8.0.80.0110.00621.54
8.0.70.0100.00721.69
8.0.60.0170.00621.32
8.0.50.0160.00721.25
8.0.30.0080.00721.83
8.0.20.0100.00421.82
8.0.10.0160.00721.35
8.0.00.0130.00523.01
7.4.330.0170.00419.43
7.4.320.0190.00621.04
7.4.300.0180.00721.07
7.4.290.0210.00521.05
7.4.280.0230.00521.10
7.4.270.0180.00621.05
7.4.260.0210.00421.08
7.4.250.0190.00621.04
7.4.240.0190.00621.04
7.4.230.0210.00521.06
7.4.220.0190.00521.10
7.4.210.0190.00721.00
7.4.200.0180.00621.05
7.4.190.0180.00721.05
7.4.180.0220.00321.09
7.4.160.0200.00521.13
7.4.150.0190.00521.07
7.4.140.0190.00521.02
7.4.130.0210.00521.03
7.4.120.0190.00720.69
7.4.110.0210.00720.67
7.4.100.0190.00620.38
7.4.90.0190.00720.37
7.4.80.0170.00620.18
7.4.70.0170.00820.21
7.4.60.0200.00719.77
7.4.50.0180.00919.45
7.4.40.0190.00919.18
7.4.30.0160.00818.65
7.4.20.0140.00917.58
7.4.10.0140.00917.48
7.4.00.0120.00916.81
7.3.330.0230.00620.96
7.3.320.0250.00620.93
7.3.310.0210.00820.93
7.3.300.0200.00621.17
7.3.290.0190.00720.94
7.3.280.0200.00720.97
7.3.270.0180.00721.00
7.3.260.0220.00320.96
7.3.250.0210.00521.03
7.3.240.0220.00620.65
7.3.230.0200.00620.66
7.3.220.0190.00820.27
7.3.210.0200.00620.30
7.3.200.0210.00620.10
7.3.190.0190.00820.13
7.3.180.0180.00819.73
7.3.170.0190.00519.53
7.3.160.0180.00719.14
7.3.150.0170.00918.57
7.3.140.0130.00917.62
7.3.130.0140.00917.48
7.3.120.0130.00816.71
7.3.110.0130.00816.70
7.3.100.0110.00916.56
7.3.90.0110.00916.47
7.3.80.0110.00916.28
7.3.70.0120.00916.16
7.3.60.0110.00916.15
7.3.50.0110.00916.17
7.3.40.0110.00816.14
7.3.30.0110.00916.17
7.3.20.0140.00916.45
7.3.10.0130.00916.45
7.3.00.0140.00916.42
7.2.340.0200.00620.64
7.2.330.0220.00720.41
7.2.320.0210.00820.25
7.2.310.0210.00719.84
7.2.300.0200.00819.81
7.2.290.0170.01019.29
7.2.280.0160.00918.75
7.2.270.0130.01117.76
7.2.260.0130.01017.64
7.2.250.0110.01016.93
7.2.240.0120.01116.90
7.2.230.0120.01016.82
7.2.220.0120.01016.70
7.2.210.0110.01016.46
7.2.200.0110.01016.37
7.2.190.0120.00916.36
7.2.180.0120.00916.37
7.2.170.0110.00916.39
7.2.160.0130.00916.35
7.2.150.0150.00916.69
7.2.140.0150.01016.67
7.2.130.0150.00916.68
7.2.120.0160.01016.68
7.2.110.0160.01016.67
7.2.100.0120.01016.68
7.2.90.0140.01016.69
7.2.80.0140.00916.67
7.2.70.0160.01016.71
7.2.60.0150.00916.66
7.2.50.0150.00916.68
7.2.40.0160.01016.71
7.2.30.0150.00916.70
7.2.20.0140.01116.67
7.2.10.0150.00916.72
7.2.00.0130.01016.71
7.1.330.0150.01016.15
7.1.320.0160.00915.92
7.1.310.0150.00915.75
7.1.300.0160.01015.64
7.1.290.0150.01015.66
7.1.280.0150.00915.65
7.1.270.0150.00915.66
7.1.260.0160.01015.62
7.1.250.0150.01015.63
7.1.240.0160.00816.23
7.1.230.0150.01016.22
7.1.220.0160.01016.24
7.1.210.0150.01016.23
7.1.200.0160.00916.24
7.1.190.0150.01016.21
7.1.180.0160.00916.24
7.1.170.0160.00916.28
7.1.160.0160.00916.25
7.1.150.0160.01016.24
7.1.140.0160.01016.25
7.1.130.0140.01116.24
7.1.120.0160.00916.25
7.1.110.0160.00916.29
7.1.100.0160.01016.31
7.1.90.0150.00916.26
7.1.80.0150.01016.28
7.1.70.0160.00916.25
7.1.60.0150.01016.24
7.1.50.0160.00916.26
7.1.40.0150.00916.26
7.1.30.0150.01016.28
7.1.20.0160.00916.26
7.1.10.0170.00816.26
7.1.00.0140.00916.22

preferences:
30.06 ms | 401 KiB | 5 Q