3v4l.org

run code in 300+ PHP versions simultaneously
<?php function score_xor($line) { $score_arr = array(); $char_scores_arr = array( "a" => 9, "b" => 1, "c" => 3, "d" => 4, "e" => 13, "f" => 2, "h" => 6, "i" => 7, "j" => 0, "k" => 1, "l" => 4, "m" => 2, "n" => 7, "o" => 8, "p" => 2, "q" => 0, "r" => 6, "s" => 6, "t" => 9, "u" => 3, "v" => 1, "w" => 2, "x" => 0, "y" => 2, "z" => 0 ); #$input = pack("H*", "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736"); $input = pack("H*", $line); for ($i = 0; $i < 128; $i++) { $ciphertext = array(); $score = 0; for ($j = 0; $j < strlen($input); $j++) { $to_add = chr(ord($input[$j]) ^ $i); array_push($ciphertext, $to_add); if (array_key_exists(strtolower($to_add), $char_scores_arr)) $score += $char_scores_arr[strtolower($to_add)] + ord($to_add); } $ciphertext = implode("", $ciphertext); $score_arr[$ciphertext] = $score; } arsort($score_arr); $count = 5; $ret = array(); foreach ($score_arr as $ciphertext => $score) { if ($count--) array_push($ret, "Text: $ciphertext\n\tScore: $score\n"); else break; } return $ret; } $txt = file_get_contents("http://cryptopals.com/static/challenge-data/4.txt"); $lines = explode("\n", $txt); $results = array(); foreach ($lines as $line) { array_push($results, score_xor($line)); } var_dump($results); ?>

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.60.0040.01117.25
8.3.50.0110.00622.92
8.3.40.0070.00719.27
8.3.30.0070.00719.29
8.3.20.0040.00420.41
8.3.10.0000.00822.28
8.3.00.0050.00317.88
8.2.180.0110.00717.00
8.2.170.0120.00322.96
8.2.160.0040.01120.64
8.2.150.0030.00624.18
8.2.140.0030.00524.66
8.2.130.0120.00326.16
8.2.120.0050.00321.19
8.2.110.0050.00522.37
8.2.100.0040.00818.16
8.2.90.0030.00619.46
8.2.80.0080.00017.97
8.2.70.0000.00817.73
8.2.60.0090.00517.93
8.2.50.0000.01018.07
8.2.40.0030.00818.31
8.2.30.0000.00818.33
8.2.20.0030.00517.96
8.2.10.0080.00018.27
8.2.00.0040.00417.98
8.1.280.0040.01125.92
8.1.270.0090.00024.09
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0030.00624.09
8.1.230.0060.00619.24
8.1.220.0000.00917.91
8.1.210.0060.00318.77
8.1.200.0030.00617.47
8.1.190.0080.00017.47
8.1.180.0040.00418.10
8.1.170.0080.00018.80
8.1.160.0080.00022.15
8.1.150.0060.00319.20
8.1.140.0030.00617.64
8.1.130.0070.00018.06
8.1.120.0040.00417.59
8.1.110.0000.00717.59
8.1.100.0000.00717.71
8.1.90.0000.00717.59
8.1.80.0040.00417.60
8.1.70.0000.00817.50
8.1.60.0030.00617.83
8.1.50.0030.00617.64
8.1.40.0040.00417.76
8.1.30.0060.00317.81
8.1.20.0040.00417.81
8.1.10.0050.00217.86
8.1.00.0030.00517.74
8.0.300.0000.00918.77
8.0.290.0080.00016.88
8.0.280.0000.00718.60
8.0.270.0060.00317.58
8.0.260.0040.00417.48
8.0.250.0030.00317.24
8.0.240.0040.00417.32
8.0.230.0040.00417.32
8.0.220.0070.00017.14
8.0.210.0000.00817.18
8.0.200.0000.00717.28
8.0.190.0060.00317.28
8.0.180.0070.00017.26
8.0.170.0000.00817.20
8.0.160.0040.00417.14
8.0.150.0020.00517.11
8.0.140.0110.00017.16
8.0.130.0060.00013.70
8.0.120.0080.00017.09
8.0.110.0040.00417.18
8.0.100.0000.00817.25
8.0.90.0040.00417.07
8.0.80.0120.01217.33
8.0.70.0000.00817.20
8.0.60.0040.00417.23
8.0.50.0000.00817.14
8.0.30.0080.01417.45
8.0.20.0150.01017.40
8.0.10.0060.00317.18
8.0.00.0110.00816.87
7.4.330.0050.00015.43
7.4.320.0000.00716.87
7.4.300.0040.00416.58
7.4.290.0000.00716.59
7.4.280.0040.00416.55
7.4.270.0000.00816.80
7.4.260.0030.00616.76
7.4.250.0040.00416.77
7.4.240.0040.00416.84
7.4.230.0040.00416.75
7.4.220.0150.00316.84
7.4.210.0030.01216.85
7.4.200.0020.00516.67
7.4.160.0070.01116.86
7.4.150.0150.01217.40
7.4.140.0130.00717.86
7.4.130.0140.00716.78
7.4.120.0130.00516.86
7.4.110.0030.01416.87
7.4.100.0200.00016.73
7.4.90.0090.00916.87
7.4.80.0070.01619.39
7.4.70.0110.00816.80
7.4.60.0110.00716.72
7.4.50.0020.00216.76
7.4.40.0090.00916.75
7.4.30.0090.00916.70
7.4.00.0000.01415.24
7.3.330.0030.00313.51
7.3.320.0040.00413.52
7.3.310.0070.00016.84
7.3.300.0080.00016.75
7.3.290.0140.00316.63
7.3.280.0090.01116.74
7.3.270.0120.00617.40
7.3.260.0060.01316.80
7.3.250.0080.01416.81
7.3.240.0090.00916.77
7.3.230.0060.01216.91
7.3.210.0130.00916.58
7.3.200.0090.01219.39
7.3.190.0070.01016.64
7.3.180.0120.00616.46
7.3.170.0130.01416.90
7.3.160.0040.01216.82
7.3.120.0090.00915.27
7.3.110.0040.01515.30
7.3.100.0060.00915.41
7.3.90.0040.01115.38
7.3.80.0030.00915.41
7.3.70.0000.01415.29
7.3.60.0100.00614.97
7.3.50.0090.00615.05
7.3.40.0070.00615.08
7.3.30.0100.00314.72
7.3.20.0060.00916.64
7.3.10.0030.01317.02
7.3.00.0060.00916.90
7.2.330.0160.00316.82
7.2.320.0150.00416.87
7.2.310.0140.01116.98
7.2.300.0030.01317.13
7.2.290.0060.01216.95
7.2.240.0070.00715.04
7.2.230.0090.00615.44
7.2.220.0060.00915.61
7.2.210.0030.01415.23
7.2.200.0070.01014.96
7.2.190.0090.00915.39
7.2.180.0060.01315.26
7.2.170.0080.00815.43
7.2.160.0060.00915.03
7.2.150.0120.00617.05
7.2.140.0070.00717.00
7.2.130.0100.00317.00
7.2.120.0060.00617.22
7.2.110.0070.01017.29
7.2.100.0040.01517.19
7.2.90.0110.00416.87
7.2.80.0100.00317.35
7.2.70.0070.00717.25
7.2.60.0040.00817.29
7.2.50.0070.01017.30
7.2.40.0000.01517.34
7.2.30.0030.01417.34
7.2.20.0080.00417.02
7.2.10.0100.00717.18
7.2.00.0090.00618.32
7.1.330.0060.00916.26
7.1.320.0070.01116.21
7.1.310.0110.00015.88
7.1.300.0000.01116.10
7.1.290.0090.00615.83
7.1.280.0140.00016.11
7.1.270.0090.00615.99
7.1.260.0000.01315.96
7.1.250.0130.00016.02
7.1.200.0030.01016.00
7.1.100.0000.01118.71
7.1.70.0060.00617.36
7.1.60.0120.00619.40
7.1.50.0030.00917.25
7.1.00.0070.07722.62
7.0.200.0030.00617.16
7.0.140.0030.07322.48
7.0.60.0030.04320.31
7.0.50.0030.07718.36
7.0.40.0100.08320.54
7.0.30.0270.07320.54
7.0.20.0170.06720.44
7.0.10.0030.08720.45
7.0.00.0000.05720.48
5.6.280.0130.06721.20
5.6.210.0130.08320.99
5.6.200.0070.08718.50
5.6.190.0130.08321.16
5.6.180.0330.07721.10
5.6.170.0170.04720.87
5.6.160.0100.06020.80
5.6.150.0130.07318.47
5.6.140.0070.07718.41
5.6.130.0100.08318.49
5.6.120.0100.08021.52
5.6.110.0100.06021.44
5.6.100.0030.04321.36
5.6.90.0100.07021.43
5.6.80.0100.06020.64
5.5.350.0070.07020.72
5.5.340.0070.09718.30
5.5.330.0070.05720.86
5.5.320.0530.05320.63
5.5.310.0200.06320.65
5.5.300.0100.07318.47
5.5.290.0030.04318.23
5.5.280.0070.05721.27
5.5.270.0030.04021.27
5.5.260.0000.04321.30
5.5.250.0000.08321.08
5.5.240.0400.04720.52
5.4.450.0330.05320.19
5.4.440.0230.05319.98
5.4.430.0370.07019.98
5.4.420.0300.07319.93
5.4.410.0370.06319.86
5.4.400.0400.05319.75
5.4.390.0370.07319.66
5.4.380.0270.03719.61
5.4.370.0330.07319.57
5.4.360.0300.07319.69
5.4.350.0330.04019.70
5.4.340.0300.07019.70
5.4.320.0270.07319.70
5.4.310.0300.07019.73
5.4.300.0230.07719.66
5.4.290.0330.05719.62
5.4.280.0400.06319.61
5.4.270.0430.06019.58
5.4.260.0470.05719.62
5.4.250.0300.07019.61
5.4.240.0300.06019.61
5.4.230.0300.07019.73
5.4.220.0300.07019.59
5.4.210.0270.07719.61
5.4.200.0270.04319.59
5.4.190.0230.05019.60
5.4.180.0270.06319.61
5.4.170.0370.06319.70
5.4.160.0300.06019.73
5.4.150.0400.06719.69
5.4.140.0300.06317.25
5.4.130.0330.06316.99
5.4.120.0300.06717.10
5.4.110.0300.07016.99
5.4.100.0230.05017.11
5.4.90.0430.05717.06
5.4.80.0330.04316.95
5.4.70.0300.06017.07
5.4.60.0330.06317.04
5.4.50.0270.07017.01
5.4.40.0300.07017.02
5.4.30.0370.06016.95
5.4.20.0230.06717.04
5.4.10.0330.06716.94
5.4.00.0300.06016.53
5.3.290.0400.05015.12
5.3.280.0230.05014.81
5.3.270.0270.07314.82
5.3.260.0400.06314.80
5.3.250.0400.06715.13
5.3.240.0400.06315.12
5.3.230.0270.07014.83
5.3.220.0300.07015.00
5.3.210.0230.07715.09
5.3.200.0270.04014.87
5.3.190.0330.06315.03
5.3.180.0300.05715.00
5.3.170.0370.06715.03
5.3.160.0300.07014.87
5.3.150.0270.05014.93
5.3.140.0270.05314.98
5.3.130.0300.07015.05
5.3.120.0300.05714.99
5.3.110.0270.07314.90
5.3.100.0470.05014.46
5.3.90.0230.05314.46
5.3.80.0370.05014.23
5.3.70.0200.06014.22
5.3.60.0370.06314.47
5.3.50.0270.07314.27
5.3.40.0230.04014.42
5.3.30.0300.03314.22
5.3.20.0200.04013.98
5.3.10.0200.03314.08
5.3.00.0170.03713.97
5.2.170.0200.04712.35
5.2.160.0230.02712.35
5.2.150.0130.03312.35
5.2.140.0170.03012.35
5.2.130.0230.02012.35
5.2.120.0130.03012.35
5.2.110.0130.03012.35
5.2.100.0170.02712.35
5.2.90.0170.02712.35
5.2.80.0170.03012.35
5.2.70.0130.03312.35
5.2.60.0200.02712.35
5.2.50.0170.03012.35
5.2.40.0130.02712.35
5.2.30.0130.02712.35
5.2.20.0200.02012.35
5.2.10.0130.02712.35
5.2.00.0170.02312.35
5.1.60.0130.02312.35
5.1.50.0100.02712.35
5.1.40.0130.02312.35
5.1.30.0130.02312.35
5.1.20.0130.02312.35
5.1.10.0070.03012.35
5.1.00.0130.02312.35
5.0.50.0070.02012.35
5.0.40.0030.02312.35
5.0.30.0100.03012.35
5.0.20.0070.01712.35
5.0.10.0030.02312.35
5.0.00.0100.02712.35
4.4.90.0030.01712.35
4.4.80.0070.01312.35
4.4.70.0130.01012.35
4.4.60.0030.01712.35
4.4.50.0030.01712.35
4.4.40.0100.02012.35
4.4.30.0030.01712.35
4.4.20.0070.01712.35
4.4.10.0070.01312.35
4.4.00.0030.03012.35
4.3.110.0070.01712.35
4.3.100.0100.01012.35
4.3.90.0030.01712.35
4.3.80.0030.03012.35
4.3.70.0070.01312.35
4.3.60.0030.02012.35
4.3.50.0070.01312.35
4.3.40.0030.02712.35
4.3.30.0000.02012.35
4.3.20.0030.02712.35
4.3.10.0030.01312.35
4.3.00.0000.01712.35

preferences:
46.93 ms | 401 KiB | 5 Q