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; } echo 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.60.0110.00716.63
8.3.50.0080.01117.75
8.3.40.0160.00619.09
8.3.30.0040.01118.92
8.3.20.0040.00419.00
8.3.10.0040.00420.61
8.3.00.0110.01119.76
8.2.180.0120.00316.75
8.2.170.0140.00022.96
8.2.160.0130.00021.38
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0050.00319.61
8.2.110.0070.00320.98
8.2.100.0040.00817.97
8.2.90.0040.00418.16
8.2.80.0040.00417.97
8.2.70.0000.00817.88
8.2.60.0090.00018.03
8.2.50.0080.00318.07
8.2.40.0040.00418.02
8.2.30.0000.01118.15
8.2.20.0080.00017.77
8.2.10.0000.00717.81
8.2.00.0050.00317.90
8.1.280.0110.00325.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0000.01021.03
8.1.230.0040.00822.68
8.1.220.0050.00317.78
8.1.210.0040.00418.79
8.1.200.0030.00617.47
8.1.190.0000.00717.53
8.1.180.0000.00918.10
8.1.170.0040.00418.84
8.1.160.0000.00718.92
8.1.150.0040.00418.73
8.1.140.0040.00417.48
8.1.130.0030.00317.73
8.1.120.0070.00017.59
8.1.110.0040.00417.61
8.1.100.0040.00417.60
8.1.90.0080.00017.66
8.1.80.0040.00317.60
8.1.70.0000.00817.63
8.1.60.0000.00817.77
8.1.50.0030.00517.57
8.1.40.0030.00517.57
8.1.30.0040.00417.76
8.1.20.0030.00517.71
8.1.10.0040.00417.63
8.1.00.0030.00617.64
8.0.300.0050.00220.13
8.0.290.0040.00416.75
8.0.280.0000.00718.32
8.0.270.0000.00717.26
8.0.260.0000.00716.88
8.0.250.0040.00416.74
8.0.240.0000.00817.11
8.0.230.0000.00817.01
8.0.220.0000.00717.05
8.0.210.0070.00017.03
8.0.200.0070.00017.06
8.0.190.0040.00417.11
8.0.180.0040.00416.95
8.0.170.0080.00016.98
8.0.160.0070.00017.01
8.0.150.0000.00716.94
8.0.140.0000.00916.86
8.0.130.0050.00313.38
8.0.120.0070.00316.97
8.0.110.0050.00316.86
8.0.100.0070.00016.97
8.0.90.0050.00216.82
8.0.80.0130.00317.00
8.0.70.0000.00816.83
8.0.60.0000.00816.93
8.0.50.0040.00416.91
8.0.30.0100.00817.42
8.0.20.0080.01117.20
8.0.10.0030.00517.02
8.0.00.0100.01217.05
7.4.330.0000.00513.28
7.4.320.0030.00316.74
7.4.300.0030.00316.81
7.4.290.0000.00716.67
7.4.280.0060.00316.85
7.4.270.0000.00816.79
7.4.260.0030.00313.48
7.4.250.0060.00316.81
7.4.240.0000.00716.74
7.4.230.0020.00516.61
7.4.220.0060.01316.86
7.4.210.0050.01116.76
7.4.200.0070.00016.70
7.4.190.0050.00316.86
7.4.160.0130.00316.66
7.4.150.0070.01016.57
7.4.140.0130.00816.66
7.4.130.0110.00816.71
7.4.120.0080.00916.85
7.4.110.0180.00016.80
7.4.100.0110.00716.68
7.4.90.0110.00716.90
7.4.80.0100.01019.39
7.4.70.0060.01016.75
7.4.60.0110.01516.58
7.4.50.0030.00616.60
7.4.40.0080.00816.78
7.4.30.0000.01616.63
7.4.00.0060.01015.02
7.3.330.0060.00013.50
7.3.320.0030.00313.43
7.3.310.0000.00716.38
7.3.300.0070.00016.55
7.3.290.0000.01516.47
7.3.280.0040.01316.49
7.3.270.0060.01216.75
7.3.260.0030.01316.48
7.3.250.0110.00616.59
7.3.240.0140.00316.53
7.3.230.0170.00016.79
7.3.210.0060.01016.75
7.3.200.0160.00316.52
7.3.190.0060.01616.57
7.3.180.0030.01216.53
7.3.170.0130.00616.47
7.3.160.0060.00916.71
7.3.120.0130.00315.20
7.2.330.0040.01316.98
7.2.320.0120.00616.87
7.2.310.0120.00916.84
7.2.300.0060.01116.88
7.2.290.0130.00317.00
7.2.00.0070.00719.87
7.1.100.0110.00018.41
7.1.70.0030.00317.47
7.1.60.0030.00917.63
7.1.50.0040.01817.20
7.1.00.0100.07322.52
7.0.200.0070.01016.99
7.0.140.0030.07321.96
7.0.120.0100.06322.15
7.0.60.0300.06719.89
7.0.50.0100.04317.76
7.0.40.0130.07717.80
7.0.30.0100.08017.82
7.0.20.0130.07317.88
7.0.10.0070.04017.73
7.0.00.0100.07317.77
5.6.210.0030.05020.47
5.6.200.0130.08018.15
5.6.190.0070.06018.18
5.6.180.0070.07718.23
5.6.170.0070.08018.17
5.6.160.0030.07018.29
5.6.150.0130.05018.21
5.6.140.0100.06318.11
5.6.130.0070.06018.27
5.6.120.0000.09018.27
5.6.110.0030.08018.15
5.6.100.0130.07318.22
5.6.90.0100.06718.23
5.6.80.0030.05017.64
5.6.70.0100.07717.53
5.6.60.0030.06017.66
5.6.50.0030.04717.57
5.6.40.0130.05317.59
5.6.30.0100.06017.54
5.6.20.0070.07717.51
5.6.10.0070.05717.64
5.6.00.0100.06717.50
5.5.350.0330.06720.39
5.5.340.0030.07317.98
5.5.330.0000.06018.07
5.5.320.0030.08318.08
5.5.310.0170.05717.94
5.5.300.0070.08017.97
5.5.290.0130.03318.08
5.5.280.0000.04718.07
5.5.270.0170.07717.93
5.5.260.0000.09018.01
5.5.250.0100.08317.79
5.5.240.0130.03317.47
5.5.230.0130.07017.41
5.5.220.0200.06317.46
5.5.210.0100.07717.36
5.5.200.0000.04317.31
5.5.190.0070.08317.38
5.5.180.0100.07317.44
5.5.160.0030.08017.30
5.5.150.0000.08717.33
5.5.140.0070.08017.40
5.5.130.0070.08017.32
5.5.120.0100.08017.31
5.5.110.0130.05717.38
5.5.100.0070.04017.34
5.5.90.0000.08717.22
5.5.80.0030.07717.30
5.5.70.0170.07017.27
5.5.60.0170.06717.20
5.5.50.0100.08017.23
5.5.40.0100.07717.19
5.5.30.0130.07017.28
5.5.20.0070.07717.18
5.5.10.0030.05717.21
5.5.00.0030.04017.18
5.4.450.0070.05719.60
5.4.440.0170.07319.43
5.4.430.0170.06019.43
5.4.420.0170.07019.30
5.4.410.0170.06719.21
5.4.400.0070.04719.13
5.4.390.0170.07019.11
5.4.380.0130.05719.03
5.4.370.0130.06019.10
5.4.360.0070.08018.97
5.4.350.0130.07319.06
5.4.340.0100.03719.09
5.4.320.0130.07718.89
5.4.310.0070.04319.27
5.4.300.0070.08019.06
5.4.290.0030.08019.11
5.4.280.0100.07319.09
5.4.270.0100.07319.27
5.4.260.0070.04319.01
5.4.250.0070.04019.05
5.4.240.0070.08018.88
5.4.230.0070.08319.09
5.4.220.0000.05019.13
5.4.210.0200.05719.02
5.4.200.0100.07019.13
5.4.190.0100.07019.04
5.4.180.0130.07319.25
5.4.170.0030.05019.04
5.4.160.0030.04019.21
5.4.150.0030.04019.13
5.4.140.0000.04016.55
5.4.130.0000.03716.32
5.4.120.0030.03316.29
5.4.110.0070.03016.23
5.4.100.0030.03716.45
5.4.90.0000.03716.41
5.4.80.0070.03316.39
5.4.70.0000.04016.37
5.4.60.0030.03316.56
5.4.50.0070.03016.22
5.4.40.0030.03316.58
5.4.30.0000.03716.29
5.4.20.0070.03016.29
5.4.10.0030.03316.52
5.4.00.0030.03315.84
5.3.290.0070.05714.74
5.3.280.0070.05314.59
5.3.270.0070.07014.63
5.3.260.0070.03314.64
5.3.250.0030.03714.61
5.3.240.0070.03314.62
5.3.230.0100.03714.70
5.3.220.0030.04314.53
5.3.210.0070.03314.66
5.3.200.0030.03714.53
5.3.190.0030.04314.52
5.3.180.0100.04714.62
5.3.170.0030.04314.55
5.3.160.0030.03714.57
5.3.150.0000.03714.61
5.3.140.0000.03714.59
5.3.130.0000.04014.57
5.3.120.0030.03714.56
5.3.110.0100.04014.57
5.3.100.0000.03714.10
5.3.90.0070.03013.97
5.3.80.0000.03714.02
5.3.70.0000.04014.04
5.3.60.0000.04713.86
5.3.50.0070.03313.95
5.3.40.0100.02714.02
5.3.30.0070.03313.94
5.3.20.0000.03713.71
5.3.10.0000.04013.66
5.3.00.0000.03713.69
5.2.170.0000.03011.18
5.2.160.0000.03311.16
5.2.150.0100.02311.23
5.2.140.0070.02311.18
5.2.130.0000.03711.20
5.2.120.0000.03011.10
5.2.110.0000.03011.17
5.2.100.0030.02710.99
5.2.90.0000.03011.06
5.2.80.0000.03011.11
5.2.70.0000.03011.19
5.2.60.0030.03011.12
5.2.50.0000.03311.23
5.2.40.0030.06310.96
5.2.30.0070.04310.88
5.2.20.0000.03711.02
5.2.10.0070.06010.89
5.2.00.0070.05310.62
5.1.60.0030.05310.20
5.1.50.0030.03310.05
5.1.40.0100.0209.82
5.1.30.0070.05010.39
5.1.20.0030.05710.32
5.1.10.0100.05310.11
5.1.00.0030.05710.04
5.0.50.0030.0308.62
5.0.40.0070.0238.39
5.0.30.0070.0608.23
5.0.20.0030.0338.28
5.0.10.0030.0408.17
5.0.00.0070.0508.21
4.4.90.0070.0107.70
4.4.80.0070.0237.70
4.4.70.0030.0207.70
4.4.60.0000.0407.70
4.4.50.0000.0337.70
4.4.40.0000.0607.70
4.4.30.0030.0337.70
4.4.20.0030.0377.70
4.4.10.0070.0277.70
4.4.00.0030.0537.70
4.3.110.0030.0337.70
4.3.100.0000.0377.70
4.3.90.0070.0277.70
4.3.80.0000.0537.70
4.3.70.0000.0377.70
4.3.60.0030.0237.70
4.3.50.0000.0407.70
4.3.40.0070.0437.70
4.3.30.0070.0377.70
4.3.20.0000.0377.70
4.3.10.0000.0337.70
4.3.00.0030.0207.70

preferences:
76.51 ms | 400 KiB | 5 Q