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 $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 . "\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.10.0140.00624.66
8.3.00.0030.00624.66
8.2.140.0030.00624.66
8.2.130.0060.01024.66
8.2.120.0070.00724.66
8.2.110.0030.00724.66
8.2.100.0090.00024.66
8.2.90.0100.00421.72
8.2.80.0110.00321.72
8.2.70.0090.00621.72
8.2.60.0060.00321.72
8.2.50.0060.00321.72
8.2.40.0090.00421.72
8.2.30.0110.00321.72
8.2.20.0070.00221.72
8.2.10.0100.00321.72
8.2.00.0100.00420.40
8.1.270.0030.00524.66
8.1.260.0070.00324.66
8.1.250.0000.00924.66
8.1.240.0000.00924.66
8.1.230.0090.00324.66
8.1.220.0100.00521.72
8.1.210.0080.00721.72
8.1.200.0090.00521.72
8.1.190.0070.00221.72
8.1.180.0110.00321.72
8.1.170.0040.01021.72
8.1.160.0150.00021.72
8.1.150.0110.00621.72
8.1.140.0110.00421.72
8.1.130.0090.00520.28
8.1.120.0080.00620.30
8.1.110.0090.00620.29
8.1.100.0120.00419.57
8.1.90.0140.00319.58
8.1.80.0130.00319.56
8.1.70.0140.00419.12
8.1.60.0110.00519.18
8.1.50.0080.00519.16
8.1.40.0130.00219.22
8.1.30.0080.00619.21
8.1.20.0080.00619.24
8.1.10.0090.00519.15
8.1.00.0110.00619.15
8.0.300.0110.00321.72
8.0.290.0090.00821.72
8.0.280.0090.00821.72
8.0.270.0120.00221.72
8.0.260.0130.00420.01
8.0.250.0080.00720.10
8.0.240.0110.00620.05
8.0.230.0090.00419.25
8.0.220.0090.00419.27
8.0.210.0110.00619.26
8.0.200.0110.00418.81
8.0.190.0090.00518.81
8.0.180.0100.00418.80
8.0.170.0120.00318.75
8.0.160.0100.00518.77
8.0.150.0080.00618.75
8.0.140.0140.00218.74
8.0.130.0110.00518.79
8.0.120.0100.00617.84
8.0.110.0100.00417.84
8.0.100.0090.00517.86
8.0.90.0130.00217.87
8.0.80.0090.00417.88
8.0.70.0090.00517.88
8.0.60.0090.00617.87
8.0.50.0090.00617.86
8.0.30.0100.00317.86
8.0.20.0110.00317.91
8.0.10.0090.00617.95
8.0.00.0080.00517.96
7.4.330.0070.00518.80
7.4.320.0120.00619.99
7.4.300.0100.00618.62
7.4.290.0080.00818.62
7.4.280.0100.00518.59
7.4.270.0110.00518.58
7.4.260.0110.00418.52
7.4.250.0130.00317.73
7.4.240.0130.00417.67
7.4.230.0130.00417.71
7.4.220.0110.00417.72
7.4.210.0120.00417.67
7.4.200.0090.00617.67
7.4.190.0080.00617.73
7.4.180.0120.00317.74
7.4.160.0100.00517.72
7.4.150.0140.00117.66
7.4.140.0090.00517.62
7.4.130.0110.00417.60
7.4.120.0130.00617.42
7.4.110.0130.00417.48
7.4.100.0100.00717.45
7.4.90.0130.00517.45
7.4.80.0130.00517.45
7.4.70.0130.00617.48
7.4.60.0120.00617.48
7.4.50.0100.00617.41
7.4.40.0130.00517.44
7.4.30.0100.00717.52
7.4.20.0090.00717.40
7.4.10.0110.00317.48
7.4.00.0070.00717.19
7.3.330.0120.00418.41
7.3.320.0100.00517.53
7.3.310.0110.00417.52
7.3.300.0130.00317.58
7.3.290.0110.00317.57
7.3.280.0110.00517.53
7.3.270.0090.00717.54
7.3.260.0140.00217.55
7.3.250.0110.00517.55
7.3.240.0120.00617.38
7.3.230.0140.00517.39
7.3.220.0140.00517.44
7.3.210.0130.00617.43
7.3.200.0150.00517.39
7.3.190.0130.00617.45
7.3.180.0140.00617.37
7.3.170.0150.00417.39
7.3.160.0120.00717.36
7.3.150.0120.00417.40
7.3.140.0130.00317.38
7.3.130.0120.00517.35
7.3.120.0090.00717.05
7.3.110.0110.00516.97
7.3.100.0110.00517.00
7.3.90.0110.00517.13
7.3.80.0080.00817.04
7.3.70.0110.00516.81
7.3.60.0100.00616.90
7.3.50.0100.00616.89
7.3.40.0120.00516.89
7.3.30.0100.00716.89
7.3.20.0120.00617.88
7.3.10.0110.00517.86
7.3.00.0160.00517.88
7.2.340.0140.00617.52
7.2.330.0090.01017.54
7.2.320.0140.00517.51
7.2.310.0130.00517.54
7.2.300.0130.00517.55
7.2.290.0120.00717.49
7.2.280.0110.00617.46
7.2.270.0130.00717.57
7.2.260.0100.00717.58
7.2.250.0110.00617.26
7.2.240.0090.00717.19
7.2.230.0100.00517.21
7.2.220.0080.00817.22
7.2.210.0100.00517.18
7.2.200.0110.00617.05
7.2.190.0120.00517.02
7.2.180.0130.00617.06
7.2.170.0100.00717.08
7.2.160.0130.00517.31
7.2.150.0080.00918.47
7.2.140.0160.00218.40
7.2.130.0140.00618.46
7.2.120.0130.00618.50
7.2.110.0130.00618.50
7.2.100.0140.00518.46
7.2.90.0130.00718.45
7.2.80.0150.00518.43
7.2.70.0120.00818.41
7.2.60.0120.00818.42
7.2.50.0150.00418.44
7.2.40.0150.00518.42
7.2.30.0140.00418.48
7.2.20.0140.00618.51
7.2.10.0150.00818.50
7.2.00.0140.00518.49
7.1.330.0100.00817.67
7.1.320.0110.00717.61
7.1.310.0120.00617.68
7.1.300.0110.00717.46
7.1.290.0120.00717.46
7.1.280.0110.00617.45
7.1.270.0130.00517.44
7.1.260.0140.00517.47
7.1.250.0150.00617.64
7.1.240.0150.00417.85
7.1.230.0190.00517.87
7.1.220.0120.00617.93
7.1.210.0130.00517.90
7.1.200.0130.00617.92
7.1.190.0150.00317.88
7.1.180.0110.00717.86
7.1.170.0130.00617.85
7.1.160.0130.00617.87
7.1.150.0130.00517.87
7.1.140.0140.00317.86
7.1.130.0180.00317.86
7.1.120.0120.00717.85
7.1.110.0150.00317.90
7.1.100.0140.00517.91
7.1.90.0140.00417.86
7.1.80.0130.00617.94
7.1.70.0110.00717.80
7.1.60.0090.01017.88
7.1.50.0140.00617.89
7.1.40.0150.00317.92
7.1.30.0130.00517.89
7.1.20.0110.00717.90
7.1.10.0120.00617.89
7.1.00.0140.00517.91

preferences:
37.25 ms | 400 KiB | 5 Q