3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt($string) { $pad = 'abcde'; $encrypted_string = ""; for ($i = 0; $i < strlen($string); $i++) { $char = $string[$i]; if ($i < strlen($pad) && preg_match("/[a-z]/i", $char)) { $shift_char = $pad[$i]; $ord_shift = ctype_upper($shift_char) ? 65 : 97; $shift_amount = ord($shift_char) - $ord_shift; if ($shift_amount) { $ord_char = ord($char) + $shift_amount; while ($ord_char > $ord_shift + 26) { $ord_char -= 26; } $char = chr($ord_char); } } $encrypted_string .= $char; } return $encrypted_string; } encrypt('this is a test');

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.40.0000.01419.09
8.3.30.0040.01118.96
8.3.20.0040.00419.05
8.3.10.0060.00320.61
8.3.00.0080.00019.63
8.2.170.0090.00622.96
8.2.160.0090.00918.96
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0080.00026.16
8.2.120.0060.00318.81
8.2.110.0050.00519.38
8.2.100.0060.00618.03
8.2.90.0050.00319.17
8.2.80.0000.00719.41
8.2.70.0090.00017.74
8.2.60.0040.00417.93
8.2.50.0030.00718.07
8.2.40.0000.00918.28
8.2.30.0000.00818.11
8.2.20.0030.00619.61
8.2.10.0040.00417.82
8.2.00.0000.00817.90
8.1.270.0000.00723.99
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00723.95
8.1.230.0090.00620.95
8.1.220.0040.00418.77
8.1.210.0040.00419.01
8.1.200.0000.00917.35
8.1.190.0030.00617.36
8.1.180.0000.00818.10
8.1.170.0110.00518.84
8.1.160.0070.00018.92
8.1.150.0080.00018.79
8.1.140.0050.00217.56
8.1.130.0070.00017.92
8.1.120.0040.00417.63
8.1.110.0040.00417.59
8.1.100.0030.00517.50
8.1.90.0080.00017.57
8.1.80.0070.00017.60
8.1.70.0070.00017.57
8.1.60.0030.00617.63
8.1.50.0000.00917.52
8.1.40.0030.00617.56
8.1.30.0050.00317.82
8.1.20.0030.00617.81
8.1.10.0000.00717.77
8.1.00.0070.00017.64
8.0.300.0000.00819.99
8.0.290.0070.00016.88
8.0.280.0030.00318.48
8.0.270.0040.00417.27
8.0.260.0000.00816.84
8.0.250.0000.00717.05
8.0.240.0040.00417.01
8.0.230.0030.00317.07
8.0.220.0000.00717.07
8.0.210.0050.00317.05
8.0.200.0030.00316.96
8.0.190.0000.00716.97
8.0.180.0030.00617.13
8.0.170.0070.00316.93
8.0.160.0050.00516.98
8.0.150.0030.00517.04
8.0.140.0050.00317.02
8.0.130.0060.00013.50
8.0.120.0040.00416.94
8.0.110.0070.00017.05
8.0.100.0040.00417.15
8.0.90.0040.00416.97
8.0.80.0100.01017.13
8.0.70.0000.00917.03
8.0.60.0080.00017.10
8.0.50.0040.00417.04
8.0.30.0100.00717.43
8.0.20.0110.01117.30
8.0.10.0000.00817.20
8.0.00.0160.00917.15
7.4.330.0030.00313.18
7.4.320.0050.00316.83
7.4.300.0040.00416.57
7.4.290.0000.00716.83
7.4.280.0000.00716.69
7.4.270.0000.00716.71
7.4.260.0000.00513.54
7.4.250.0040.00416.82
7.4.240.0070.00016.82
7.4.230.0050.00216.83
7.4.220.0130.00716.72
7.4.210.0070.01016.92
7.4.200.0030.00316.90
7.4.190.0070.00016.70
7.4.160.0150.00016.90
7.4.150.0200.00316.51
7.4.140.0030.01416.54
7.4.130.0040.01216.69
7.4.120.0070.01016.64
7.4.110.0070.01016.75
7.4.100.0160.00916.65
7.4.90.0250.01916.89
7.4.80.0030.01516.89
7.4.70.0060.01316.71
7.4.60.0030.01716.67
7.4.50.0030.00316.75
7.4.40.0000.01916.68
7.4.30.0100.00616.73
7.4.00.0080.00815.07
7.3.330.0030.00313.50
7.3.320.0030.00313.45
7.3.310.0000.00716.50
7.3.300.0060.00016.38
7.3.290.0110.00316.54
7.3.280.0040.01516.48
7.3.270.0100.00716.50
7.3.260.0000.01816.43
7.3.250.0120.00916.68
7.3.240.0090.01316.83
7.3.230.0070.01916.76
7.3.210.0040.01416.76
7.3.200.0110.00819.39
7.3.190.0030.01316.75
7.3.180.0060.01016.52
7.3.170.0090.00916.76
7.3.160.0060.01016.74
7.3.120.0060.00615.27
7.2.330.0120.00916.82
7.2.320.0130.01016.88
7.2.310.0070.01017.07
7.2.300.0110.00716.96
7.2.290.0130.00316.93
7.2.60.0100.00617.05
7.2.00.0030.01019.86
7.1.200.0040.00415.98
7.1.100.0090.00018.61
7.1.70.0050.00217.36
7.1.60.0070.01819.31
7.1.50.0060.00617.07
7.1.00.0070.04722.29
7.0.200.0050.00317.09
7.0.140.0000.07721.95
7.0.120.0030.07322.18
7.0.60.0330.07020.00
7.0.50.0130.08017.76
7.0.40.0200.04020.16
7.0.30.0430.06020.13
7.0.20.0230.04020.04
7.0.10.0170.04720.25
7.0.00.0270.05020.32
5.6.280.0070.07020.92
5.6.210.0030.04020.48
5.6.200.0130.04718.14
5.6.190.0170.04320.55
5.6.180.0200.05020.55
5.6.170.0230.05020.59
5.6.160.0270.07720.60
5.6.150.0270.07720.18
5.6.140.0200.08720.41
5.6.130.0200.06720.17
5.6.120.0300.08720.38
5.6.110.0230.08320.49
5.6.100.0270.08320.39
5.6.90.0270.05020.30
5.6.80.0470.06319.62
5.6.70.0200.04319.55
5.6.60.0370.07719.79
5.6.50.0430.06719.80
5.6.40.0270.07719.53
5.6.30.0370.07319.73
5.6.20.0330.06319.59
5.6.10.0270.04319.59
5.6.00.0400.07019.71
5.5.350.4230.04320.39
5.5.340.0070.08318.02
5.5.330.0200.05020.19
5.5.320.0370.04320.20
5.5.310.0330.04320.47
5.5.300.0170.04720.13
5.5.290.0270.04320.21
5.5.280.0270.04720.13
5.5.270.0370.07320.03
5.5.260.0330.08720.03
5.5.250.0270.04719.95
5.5.240.0330.07019.68
5.5.230.0400.05319.59
5.5.220.0330.07719.52
5.5.210.0230.05719.35
5.5.200.0300.05719.35
5.5.190.0200.08719.33
5.5.180.0300.05019.68
5.5.160.0300.08319.38
5.5.150.0300.03719.34
5.5.140.0300.03319.56
5.5.130.0300.05319.55
5.5.120.0270.04719.65
5.5.110.0330.07019.32
5.5.100.0270.07719.38
5.5.90.0270.08019.29
5.5.80.0370.07319.45
5.5.70.0330.05319.54
5.5.60.0270.05019.21
5.5.50.0300.06719.56
5.5.40.0330.06719.43
5.5.30.0370.03019.48
5.5.20.0230.05019.61
5.5.10.0200.06719.27
5.5.00.0370.07319.36
5.4.450.0370.07019.57
5.4.440.0270.03719.47
5.4.430.0230.04719.40
5.4.420.0230.04719.44
5.4.410.0300.06019.05
5.4.400.0400.06019.16
5.4.390.0330.07019.21
5.4.380.0270.03719.15
5.4.370.0370.03018.86
5.4.360.0370.06719.24
5.4.350.0270.06018.85
5.4.340.0330.06718.86
5.4.320.0400.06319.26
5.4.310.0270.06019.08
5.4.300.0270.03719.08
5.4.290.0270.05319.09
5.4.280.0370.06319.15
5.4.270.0300.05318.85
5.4.260.0330.06318.87
5.4.250.0330.05319.08
5.4.240.0300.06719.12
5.4.230.0300.06718.92
5.4.220.0270.07019.16
5.4.210.0300.04719.07
5.4.200.0270.05318.85
5.4.190.0330.06718.97
5.4.180.0270.06718.91
5.4.170.0330.07319.19
5.4.160.0300.04018.86
5.4.150.0300.05319.22
5.4.140.0300.05716.32
5.4.130.0400.05716.45
5.4.120.0200.06716.47
5.4.110.0330.06016.44
5.4.100.0270.05016.53
5.4.90.0270.07016.48
5.4.80.0300.06316.57
5.4.70.0270.06316.43
5.4.60.0330.06716.38
5.4.50.0300.03716.38
5.4.40.0270.06316.44
5.4.30.0300.06016.73
5.4.20.0230.07016.31
5.4.10.0270.06716.41
5.4.00.0330.06715.80
5.3.290.0370.06314.66
5.3.280.0330.06714.59
5.3.270.0300.05314.64
5.3.260.0270.05714.66
5.3.250.0270.05014.61
5.3.240.0500.04714.49
5.3.230.0300.07714.61
5.3.220.0330.04014.71
5.3.210.0300.07014.71
5.3.200.0270.04014.56
5.3.190.0300.03314.57
5.3.180.0600.05314.60
5.3.170.0200.04314.59
5.3.160.0370.03014.62
5.3.150.0430.05714.57
5.3.140.0270.07014.71
5.3.130.0200.04014.59
5.3.120.0270.06714.57
5.3.110.0330.04314.54
5.3.100.0300.04314.05
5.3.90.0300.06014.07
5.3.80.0230.07014.02
5.3.70.0230.06314.09
5.3.60.0300.07314.17
5.3.50.0330.05714.09
5.3.40.0230.03714.11
5.3.30.0270.03713.90
5.3.20.0330.07013.68
5.3.10.0300.04313.62
5.3.00.0300.03713.80
5.2.170.0170.04313.42
5.2.160.0230.02713.42
5.2.150.0270.03013.42
5.2.140.0170.03313.42
5.2.130.0230.06013.42
5.2.120.0170.05013.42
5.2.110.0300.05313.42
5.2.100.0200.06313.42
5.2.90.0230.05013.42
5.2.80.0270.04713.42
5.2.70.0230.06013.42
5.2.60.0330.05313.42
5.2.50.0270.02713.42
5.2.40.0200.02713.42
5.2.30.0230.05313.42
5.2.20.0170.04313.42
5.2.10.0230.04713.42
5.2.00.0270.02713.42
5.1.60.0170.03713.42
5.1.50.0370.03013.42
5.1.40.0230.05013.42
5.1.30.0200.05313.42
5.1.20.0170.03013.42
5.1.10.0170.03313.42
5.1.00.0230.03713.42
5.0.50.0130.01713.42
5.0.40.0100.03313.42
5.0.30.0100.04013.42
5.0.20.0100.04713.42
5.0.10.0070.04313.42
5.0.00.0100.06313.42
4.4.90.0130.03313.42
4.4.80.0100.03313.42
4.4.70.0070.01713.42
4.4.60.0100.03713.42
4.4.50.0070.03713.42
4.4.40.0170.04313.42
4.4.30.0130.01313.42
4.4.20.0100.02313.42
4.4.10.0130.01013.42
4.4.00.0070.03013.42
4.3.110.0130.02313.42
4.3.100.0100.02013.42
4.3.90.0130.01713.42
4.3.80.0100.03713.42
4.3.70.0070.02713.42
4.3.60.0100.02713.42
4.3.50.0130.03013.42
4.3.40.0170.03313.42
4.3.30.0070.02313.42
4.3.20.0100.03313.42
4.3.10.0100.03013.42
4.3.00.0000.03313.42

preferences:
44.65 ms | 400 KiB | 5 Q