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]; $ord_shift = ctype_upper($shift_char) ? 65 : 97; if ($i < strlen($pad) && preg_match("/[a-z]/i", $char)) { $shift_char = $pad[$i]; $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.60.0070.01417.00
8.3.50.0100.00717.63
8.3.40.0040.01118.78
8.3.30.0120.00918.89
8.3.20.0030.00619.02
8.3.10.0080.00018.95
8.3.00.0030.00519.38
8.2.180.0200.00017.00
8.2.170.0140.00322.96
8.2.160.0060.00919.14
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00419.07
8.2.110.0080.00020.35
8.2.100.0070.00418.03
8.2.90.0030.00619.17
8.2.80.0070.00019.31
8.2.70.0090.00018.00
8.2.60.0080.00017.91
8.2.50.0000.00818.07
8.2.40.0050.00318.16
8.2.30.0000.00818.13
8.2.20.0030.00519.66
8.2.10.0050.00317.95
8.2.00.0040.00417.96
8.1.280.0090.01225.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0000.00922.13
8.1.230.0080.00422.70
8.1.220.0000.00918.77
8.1.210.0050.00319.00
8.1.200.0060.00317.47
8.1.190.0040.00417.51
8.1.180.0040.00418.10
8.1.170.0050.00318.78
8.1.160.0070.00018.79
8.1.150.0000.00718.70
8.1.140.0030.00617.55
8.1.130.0030.00317.82
8.1.120.0070.00017.55
8.1.110.0080.00017.52
8.1.100.0050.00217.57
8.1.90.0040.00417.61
8.1.80.0000.00717.60
8.1.70.0080.00017.53
8.1.60.0090.00017.75
8.1.50.0040.00417.63
8.1.40.0030.00517.68
8.1.30.0080.00017.67
8.1.20.0000.00817.67
8.1.10.0040.00417.76
8.1.00.0000.00817.68
8.0.300.0000.00719.84
8.0.290.0070.00016.75
8.0.280.0080.00018.53
8.0.270.0000.00717.21
8.0.260.0070.00016.95
8.0.250.0070.00017.12
8.0.240.0060.00317.16
8.0.230.0000.00717.21
8.0.220.0030.00317.11
8.0.210.0080.00016.96
8.0.200.0040.00417.17
8.0.190.0080.00017.16
8.0.180.0000.00717.02
8.0.170.0000.00917.05
8.0.160.0060.00317.17
8.0.150.0080.00017.08
8.0.140.0040.00716.95
8.0.130.0030.00313.53
8.0.120.0050.00317.02
8.0.110.0000.00717.09
8.0.100.0040.00417.01
8.0.90.0040.00416.98
8.0.80.0100.00617.04
8.0.70.0000.00817.05
8.0.60.0070.00017.04
8.0.50.0000.00717.13
8.0.30.0110.00717.26
8.0.20.0120.00617.29
8.0.10.0080.00017.25
8.0.00.0090.01016.96
7.4.330.0050.00013.24
7.4.320.0030.00316.73
7.4.300.0030.00316.71
7.4.290.0000.00716.73
7.4.280.0050.00316.73
7.4.270.0000.00716.74
7.4.260.0030.00313.60
7.4.250.0030.00516.70
7.4.240.0000.00716.85
7.4.230.0050.00216.89
7.4.220.0070.01016.73
7.4.210.0130.00616.84
7.4.200.0070.00016.82
7.4.190.0040.00416.69
7.4.160.0040.01116.63
7.4.150.0160.00016.69
7.4.140.0150.00316.69
7.4.130.0040.01216.75
7.4.120.0070.01016.85
7.4.110.0100.00716.88
7.4.100.0030.01316.80
7.4.90.0100.00716.67
7.4.80.0100.00719.39
7.4.70.0100.00616.60
7.4.60.0080.00916.64
7.4.50.0000.00816.47
7.4.40.0040.01116.73
7.4.30.0130.00316.82
7.4.00.0040.01115.24
7.3.330.0030.00313.57
7.3.320.0000.00613.35
7.3.310.0030.00516.46
7.3.300.0060.00016.66
7.3.290.0060.00916.53
7.3.280.0140.00616.50
7.3.270.0000.01816.62
7.3.260.0030.01316.54
7.3.250.0070.01016.57
7.3.240.0070.01516.84
7.3.230.0090.00916.82
7.3.210.0060.00916.56
7.3.200.0080.00816.51
7.3.190.0100.00716.81
7.3.180.0090.00916.56
7.3.170.0070.01416.70
7.3.160.0100.00716.91
7.3.120.0070.01115.16
7.2.330.0130.00416.96
7.2.320.0040.01316.71
7.2.310.0160.00316.89
7.2.300.0030.02117.09
7.2.290.0130.00716.90
7.2.00.0030.01019.71
7.1.100.0440.02016.34
7.1.70.0060.00817.39
7.1.60.0060.01819.30
7.1.50.0070.01417.15
7.1.00.0070.05722.32
7.0.200.0040.00816.62
7.0.140.0030.07322.19
7.0.120.0000.03322.16
7.0.60.0230.08021.65
7.0.50.0070.05717.95
7.0.40.0300.05020.26
7.0.30.0500.06020.04
7.0.20.0230.04320.12
7.0.10.0270.04020.32
7.0.00.0230.09320.18
5.6.280.0000.07720.91
5.6.210.0200.07020.76
5.6.200.0000.08718.12
5.6.190.0370.07020.49
5.6.180.0300.06020.49
5.6.170.0270.05320.48
5.6.160.0500.05320.52
5.6.150.0330.07720.52
5.6.140.0200.05720.32
5.6.130.0300.06020.41
5.6.120.0330.08020.41
5.6.110.0370.07720.32
5.6.100.0300.06320.22
5.6.90.0330.06020.32
5.6.80.0370.03719.79
5.6.70.0270.05019.79
5.6.60.0330.03319.79
5.6.50.0300.07319.63
5.6.40.0330.04319.70
5.6.30.0330.07019.70
5.6.20.0270.05319.59
5.6.10.0230.05319.56
5.6.00.0300.07019.69
5.5.350.0100.08320.45
5.5.340.0000.05018.04
5.5.330.0330.06720.40
5.5.320.0300.06020.30
5.5.310.0300.03720.42
5.5.300.0470.06720.11
5.5.290.0430.06320.33
5.5.280.0270.05320.13
5.5.270.0330.08020.13
5.5.260.0230.06719.97
5.5.250.0300.05319.86
5.5.240.0300.08019.51
5.5.230.0270.04019.61
5.5.220.0270.05019.37
5.5.210.0330.08019.58
5.5.200.0270.07719.50
5.5.190.0270.04319.68
5.5.180.0270.08319.59
5.5.160.0230.04719.32
5.5.150.0270.06319.59
5.5.140.0300.06019.34
5.5.130.0300.07719.55
5.5.120.0300.07719.55
5.5.110.0400.06019.33
5.5.100.0330.05319.29
5.5.90.0270.07019.49
5.5.80.0270.07319.56
5.5.70.0270.04019.22
5.5.60.0270.03719.24
5.5.50.0270.04319.44
5.5.40.0200.04319.47
5.5.30.0300.07319.29
5.5.20.0330.07319.48
5.5.10.0300.05319.21
5.5.00.0300.07319.27
5.4.450.0270.04319.33
5.4.440.0300.04719.54
5.4.430.0370.05319.32
5.4.420.0300.05319.47
5.4.410.0600.05319.14
5.4.400.0300.05018.95
5.4.390.0400.06319.09
5.4.380.0300.03318.98
5.4.370.0370.04019.12
5.4.360.0270.04718.84
5.4.350.0330.04719.12
5.4.340.0230.07719.08
5.4.320.0330.03318.98
5.4.310.0270.03718.87
5.4.300.0400.05318.85
5.4.290.0300.04018.98
5.4.280.0430.06019.24
5.4.270.0370.06719.14
5.4.260.0370.05318.85
5.4.250.0300.06718.85
5.4.240.0230.05319.14
5.4.230.0300.03319.17
5.4.220.0230.05019.11
5.4.210.0330.05719.01
5.4.200.0230.04318.95
5.4.190.0300.07018.86
5.4.180.0230.04019.23
5.4.170.0270.04719.14
5.4.160.0270.06019.15
5.4.150.0330.06718.84
5.4.140.0300.06716.59
5.4.130.0300.03016.54
5.4.120.0300.04316.30
5.4.110.0300.05316.50
5.4.100.0270.04016.50
5.4.90.0300.04316.59
5.4.80.0330.06016.51
5.4.70.0300.08716.32
5.4.60.0200.04716.41
5.4.50.0270.03716.38
5.4.40.0370.06316.28
5.4.30.0270.04016.39
5.4.20.0200.03716.43
5.4.10.0370.06316.31
5.4.00.0300.06315.85
5.3.290.0300.06014.72
5.3.280.0270.03714.59
5.3.270.0300.06714.65
5.3.260.0370.03314.61
5.3.250.0370.05714.75
5.3.240.0270.07714.62
5.3.230.0370.06314.61
5.3.220.0400.06314.56
5.3.210.0230.05314.56
5.3.200.0300.05014.57
5.3.190.0230.04314.71
5.3.180.0370.03714.56
5.3.170.0230.04014.62
5.3.160.0300.07014.59
5.3.150.0300.07314.57
5.3.140.0330.07014.61
5.3.130.0230.04014.60
5.3.120.0270.04714.58
5.3.110.0230.03714.59
5.3.100.0300.06014.05
5.3.90.0330.07014.03
5.3.80.0270.06014.01
5.3.70.0370.06714.02
5.3.60.0400.06014.00
5.3.50.0370.05314.00
5.3.40.0330.04013.98
5.3.30.0330.06313.80
5.3.20.0300.04713.61
5.3.10.0330.06713.65
5.3.00.0300.05013.67
5.2.170.0230.06312.62
5.2.160.0300.05312.62
5.2.150.0300.05312.62
5.2.140.0200.05712.62
5.2.130.0230.05012.62
5.2.120.0270.05712.62
5.2.110.0200.05712.62
5.2.100.0230.04012.62
5.2.90.0200.03712.62
5.2.80.0200.03312.62
5.2.70.0230.04012.62
5.2.60.0270.06012.62
5.2.50.0230.05712.62
5.2.40.0200.05012.62
5.2.30.0270.04012.62
5.2.20.0200.03312.62
5.2.10.0170.04012.62
5.2.00.0270.04712.62
5.1.60.0200.04312.62
5.1.50.0300.03312.62
5.1.40.0230.03312.62
5.1.30.0200.03012.62
5.1.20.0270.05012.62
5.1.10.0230.04012.62
5.1.00.0170.02712.62
5.0.50.0130.03712.62
5.0.40.0130.02712.62
5.0.30.0230.04012.62
5.0.20.0070.04312.62
5.0.10.0130.04312.62
5.0.00.0130.06312.62
4.4.90.0100.02312.62
4.4.80.0100.03712.62
4.4.70.0030.02312.62
4.4.60.0100.01712.62
4.4.50.0070.02312.62
4.4.40.0100.03012.62
4.4.30.0100.03712.62
4.4.20.0100.02712.62
4.4.10.0100.01312.62
4.4.00.0130.05012.62
4.3.110.0100.03012.62
4.3.100.0130.01712.62
4.3.90.0170.02712.62
4.3.80.0230.04312.62
4.3.70.0100.03312.62
4.3.60.0070.02712.62
4.3.50.0070.02312.62
4.3.40.0130.05012.62
4.3.30.0030.02312.62
4.3.20.0030.03312.62
4.3.10.0030.02012.62
4.3.00.0030.01712.62

preferences:
45.21 ms | 401 KiB | 5 Q