3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Model { /** * Calculate the encryption give a static OTP */ public static function encrypt($string) { // Static pad $pad = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmno'; $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 Model::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.00316.75
8.3.50.0120.00722.00
8.3.40.0120.00318.75
8.3.30.0120.00319.17
8.3.20.0040.00420.16
8.3.10.0040.00423.70
8.3.00.0040.00419.38
8.2.180.0130.00318.54
8.2.170.0110.00322.96
8.2.160.0140.00020.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00322.27
8.2.110.0090.00022.07
8.2.100.0040.00718.03
8.2.90.0040.00419.34
8.2.80.0040.00417.97
8.2.70.0000.00818.00
8.2.60.0040.00418.05
8.2.50.0050.00318.07
8.2.40.0080.00018.22
8.2.30.0030.00518.06
8.2.20.0070.00017.88
8.2.10.0050.00318.16
8.2.00.0040.00417.89
8.1.280.0150.00625.92
8.1.270.0060.00323.92
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00023.65
8.1.230.0040.00719.01
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0080.00017.53
8.1.180.0080.00018.10
8.1.170.0040.00418.77
8.1.160.0030.00522.05
8.1.150.0040.00418.79
8.1.140.0000.00717.64
8.1.130.0070.00017.86
8.1.120.0040.00417.61
8.1.110.0040.00417.54
8.1.100.0000.00817.59
8.1.90.0030.00517.52
8.1.80.0000.00817.52
8.1.70.0030.00317.52
8.1.60.0030.00617.75
8.1.50.0030.00517.63
8.1.40.0080.00017.71
8.1.30.0040.00417.77
8.1.20.0040.00417.73
8.1.10.0040.00417.71
8.1.00.0000.00817.67
8.0.300.0040.00418.77
8.0.290.0000.00817.18
8.0.280.0000.00718.31
8.0.270.0030.00317.28
8.0.260.0060.00016.96
8.0.250.0030.00317.10
8.0.240.0000.00917.11
8.0.230.0040.00416.98
8.0.220.0030.00316.95
8.0.210.0030.00317.04
8.0.200.0040.00417.16
8.0.190.0000.00716.99
8.0.180.0040.00417.05
8.0.170.0030.00517.02
8.0.160.0050.00217.03
8.0.150.0030.00516.88
8.0.140.0030.00516.98
8.0.130.0000.00613.46
8.0.120.0000.00817.01
8.0.110.0050.00216.93
8.0.100.0070.00017.09
8.0.90.0040.00417.03
8.0.80.0040.01117.05
8.0.70.0040.00417.09
8.0.60.0040.00416.91
8.0.50.0000.00816.92
8.0.30.0160.00517.17
8.0.20.0060.01217.40
8.0.10.0000.00717.11
8.0.00.0100.01017.01
7.4.330.0060.00015.00
7.4.320.0020.00516.80
7.4.300.0070.00016.75
7.4.290.0060.00316.77
7.4.280.0050.00316.67
7.4.270.0030.00316.73
7.4.260.0030.00316.80
7.4.250.0050.00316.78
7.4.240.0020.00516.69
7.4.230.0040.00316.91
7.4.220.0130.01016.82
7.4.210.0040.01116.73
7.4.200.0030.00416.61
7.4.190.0070.00016.53
7.4.160.0120.00316.58
7.4.150.0110.00717.40
7.4.140.0110.00717.86
7.4.130.0110.00516.82
7.4.120.0130.00316.80
7.4.110.0090.01516.85
7.4.100.0160.01016.78
7.4.90.0100.00616.72
7.4.80.0120.00919.39
7.4.70.0130.00716.68
7.4.60.0040.01416.76
7.4.50.0000.00816.53
7.4.40.0100.00722.77
7.4.30.0130.00316.61
7.4.10.0060.00915.40
7.4.00.0050.01215.17
7.3.330.0030.00313.37
7.3.320.0000.00613.52
7.3.310.0030.00316.38
7.3.300.0000.00716.39
7.3.290.0100.00716.47
7.3.280.0110.00816.54
7.3.270.0110.00617.40
7.3.260.0150.00316.55
7.3.250.0110.01016.74
7.3.240.0090.00916.52
7.3.230.0060.01116.58
7.3.210.0170.00316.86
7.3.200.0000.01619.39
7.3.190.0120.00616.83
7.3.180.0040.01216.46
7.3.170.0100.01016.73
7.3.160.0060.01116.73
7.3.130.0070.01114.94
7.3.120.0080.00815.10
7.3.110.0130.00615.29
7.3.100.0070.00714.94
7.3.90.0030.01015.04
7.3.80.0060.00615.15
7.3.70.0070.00715.13
7.3.60.0120.00015.04
7.3.50.0070.00715.01
7.3.40.0000.01415.09
7.3.30.0070.00314.68
7.3.20.0060.01016.92
7.3.10.0050.01016.77
7.3.00.0010.01216.99
7.2.330.0100.00716.92
7.2.320.0060.00916.84
7.2.310.0160.00316.88
7.2.300.0140.00416.69
7.2.290.0090.00916.82
7.2.260.0100.01015.53
7.2.250.0070.01015.21
7.2.240.0090.00615.30
7.2.230.0060.01115.20
7.2.220.0060.00915.03
7.2.210.0070.00715.34
7.2.200.0060.00915.29
7.2.190.0060.00315.24
7.2.180.0060.00615.24
7.2.170.0060.00615.40
7.2.160.0070.00715.43
7.2.150.0060.01317.09
7.2.140.0080.00816.98
7.2.130.0050.00717.17
7.2.120.0080.00517.00
7.2.110.0050.01017.11
7.2.100.0060.00817.15
7.2.90.0060.00817.15
7.2.80.0110.00317.22
7.2.70.0060.00917.09
7.2.60.0060.00917.15
7.2.50.0030.01117.03
7.2.40.0030.00917.12
7.2.30.0090.00617.07
7.2.20.0080.00517.08
7.2.10.0060.00817.10
7.2.00.0060.00817.68
7.1.330.0090.00615.94
7.1.320.0000.01316.07
7.1.310.0040.01115.86
7.1.300.0040.00815.80
7.1.290.0030.01016.21
7.1.280.0070.00716.04
7.1.270.0040.01115.93
7.1.260.0070.01016.00
7.1.250.0040.00816.17
7.1.240.0070.00516.05
7.1.230.0080.00715.94
7.1.220.0050.01015.97
7.1.210.0050.00915.96
7.1.200.0050.00816.04
7.1.190.0070.00515.88
7.1.180.0060.00616.06
7.1.170.0050.00915.89
7.1.160.0040.00815.95
7.1.150.0040.00915.88
7.1.140.0020.01216.02
7.1.130.0070.00515.97
7.1.120.0080.00315.94
7.1.110.0080.00616.03
7.1.100.0050.00716.81
7.1.90.0050.00515.97
7.1.80.0040.00715.97
7.1.70.0030.00716.39
7.1.60.0050.01117.20
7.1.50.0050.01016.38
7.1.40.0030.00715.93
7.1.30.0050.01015.82
7.1.20.0030.01015.88
7.1.10.0020.01115.94
7.1.00.0070.02918.02
7.0.330.0120.00015.42
7.0.320.0080.00715.58
7.0.310.0050.00915.73
7.0.300.0030.01015.57
7.0.290.0060.00715.57
7.0.280.0030.01115.61
7.0.270.0020.01115.66
7.0.260.0060.00515.65
7.0.250.0050.00715.53
7.0.240.0110.00315.44
7.0.230.0050.00815.73
7.0.220.0060.00615.54
7.0.210.0100.00315.74
7.0.200.0050.01015.99
7.0.190.0000.01415.41
7.0.180.0040.00815.42
7.0.170.0030.01115.63
7.0.160.0060.00715.51
7.0.150.0030.01015.70
7.0.140.0060.02917.67
7.0.130.0080.00615.48
7.0.120.0010.00715.50
7.0.110.0060.00315.55
7.0.100.0020.01215.50
7.0.90.0030.00915.52
7.0.80.0060.00615.61
7.0.70.0060.02317.66
7.0.60.0060.02917.68
7.0.50.0060.03017.80
7.0.40.0010.03915.86
7.0.30.0060.03315.95
7.0.20.0070.03115.84
7.0.10.0050.03115.83
7.0.00.0060.02915.70
5.6.400.0070.01014.43
5.6.390.0030.00714.27
5.6.380.0070.00714.77
5.6.370.0030.00914.61
5.6.360.0040.01114.54
5.6.350.0050.00714.56
5.6.340.0080.00514.44
5.6.330.0080.00414.62
5.6.320.0030.00514.52
5.6.310.0030.00714.22
5.6.300.0040.01014.46
5.6.290.0030.01214.12
5.6.280.0040.03016.76
5.6.270.0070.00614.34
5.6.260.0060.00614.59
5.6.250.0060.00714.43
5.6.240.0080.00514.38
5.6.230.0030.01214.37
5.6.220.0100.02916.51
5.6.210.0040.03116.62
5.6.200.0040.03416.71
5.6.190.0070.02716.60
5.6.180.0060.03116.61
5.6.170.0060.02416.58
5.6.160.0080.03016.61
5.6.150.0080.03116.70
5.6.140.0100.03016.53
5.6.130.0070.03216.58
5.6.120.0060.01816.70
5.6.110.0050.01916.54
5.6.100.0000.03116.68
5.6.90.0040.02216.63
5.6.80.0040.03116.34
5.6.70.0020.02616.37
5.6.60.0070.03016.42
5.6.50.0060.03216.42
5.6.40.0070.02916.25
5.6.30.0050.02116.47
5.6.20.0030.03416.45
5.6.10.0070.03116.47
5.6.00.0010.03216.49
5.5.380.0070.00212.64
5.5.370.0060.00812.94
5.5.360.0030.03215.33
5.5.350.0040.02215.34
5.5.340.0020.03015.64
5.5.330.0060.02115.75
5.5.320.0070.02215.57
5.5.310.0030.03515.57
5.5.300.0040.02915.49
5.5.290.0040.02915.49
5.5.280.0080.02915.60
5.5.270.0050.03115.48
5.5.260.0020.03115.55
5.5.250.0070.03015.37
5.5.240.0030.03415.31
5.5.230.0040.03515.23
5.5.220.0040.03115.27
5.5.210.0070.02815.31
5.5.200.0060.03215.12
5.5.190.0070.01715.18
5.5.180.0060.02915.31
5.5.170.0020.01112.99
5.5.160.0080.02515.21
5.5.150.0060.02715.30
5.5.140.0070.02315.16
5.5.130.0020.03215.28
5.5.120.0050.03015.23
5.5.110.0080.02915.30
5.5.100.0080.03415.31
5.5.90.0030.02315.31
5.5.80.0030.02015.18
5.5.70.0060.02915.15
5.5.60.0040.02815.17
5.5.50.0040.03115.36
5.5.40.0070.03115.30
5.5.30.0050.03015.18
5.5.20.0060.02315.15
5.5.10.0060.02115.22
5.5.00.0030.02215.24
5.4.450.0040.03214.02
5.4.440.0030.01913.95
5.4.430.0030.02213.97
5.4.420.0030.02213.86
5.4.410.0050.02914.10
5.4.400.0080.02313.93
5.4.390.0030.02813.73
5.4.380.0030.03113.87
5.4.370.0040.03013.70
5.4.360.0080.01613.97
5.4.350.0020.02913.81
5.4.340.0070.01613.76
5.4.330.0060.00311.23
5.4.320.0020.03413.81
5.4.310.0030.02213.79
5.4.300.0060.02613.88
5.4.290.0020.02413.96
5.4.280.0050.02813.67
5.4.270.0040.02013.88
5.4.260.0050.02213.66
5.4.250.0050.02913.60
5.4.240.0010.03213.81
5.4.230.0040.02613.76
5.4.220.0010.03113.89
5.4.210.0040.03013.74
5.4.200.0030.03113.88
5.4.190.0040.02613.93
5.4.180.0060.02513.82
5.4.170.0020.03313.95
5.4.160.0080.02713.87
5.4.150.0070.02813.76
5.4.140.0070.02713.02
5.4.130.0050.02113.02
5.4.120.0060.02612.90
5.4.110.0030.02212.82
5.4.100.0060.02012.81
5.4.90.0050.02712.82
5.4.80.0020.01912.93
5.4.70.0060.01712.89
5.4.60.0070.02913.00
5.4.50.0030.02312.91
5.4.40.0010.02112.90
5.4.30.0010.03312.73
5.4.20.0070.02613.07
5.4.10.0080.02112.91
5.4.00.0070.02312.85
5.3.290.0030.02112.06
5.3.280.0020.03111.89
5.3.270.0020.02512.04
5.3.260.0030.02212.07
5.3.250.0050.01512.00
5.3.240.0030.02711.94
5.3.230.0090.02311.97
5.3.220.0010.03111.95
5.3.210.0080.02111.91
5.3.200.0010.01811.96
5.3.190.0040.02611.95
5.3.180.0040.02111.94
5.3.170.0040.03011.93
5.3.160.0040.01411.94
5.3.150.0020.02811.86
5.3.140.0040.02511.87
5.3.130.0040.03111.98
5.3.120.0040.03011.83
5.3.110.0040.02211.98
5.3.100.0050.02511.75
5.3.90.0080.02411.73
5.3.80.0050.02311.71
5.3.70.0040.02811.74
5.3.60.0050.01911.75
5.3.50.0040.03011.72
5.3.40.0050.01811.66
5.3.30.0050.02611.58
5.3.20.0040.02911.72
5.3.10.0030.02611.54
5.3.00.0060.02511.43
5.2.170.0030.02811.12
5.2.160.0050.02511.12
5.2.150.0020.02211.12
5.2.140.0020.03611.12
5.2.130.0050.03211.12
5.2.120.0030.02111.12
5.2.110.0050.03011.12
5.2.100.0030.03011.12
5.2.90.0000.02911.12
5.2.80.0030.03211.12
5.2.70.0060.03011.12
5.2.60.0020.02511.12
5.2.50.0030.03011.12
5.2.40.0070.02011.12
5.2.30.0050.02811.12
5.2.20.0000.03711.12
5.2.10.0030.03011.12
5.2.00.0020.02011.12
5.1.60.0020.02311.12
5.1.50.0020.01511.12
5.1.40.0010.01611.12
5.1.30.0060.01211.12
5.1.20.0020.02111.12
5.1.10.0040.01311.12
5.1.00.0000.01711.12
5.0.50.0030.01211.12
5.0.40.0020.01211.12
5.0.30.0040.01711.12
5.0.20.0040.01011.12
5.0.10.0010.01411.12
5.0.00.0020.02211.12
4.4.90.0020.01811.12
4.4.80.0030.01411.12
4.4.70.0020.02011.12
4.4.60.0020.01511.12
4.4.50.0030.01811.12
4.4.40.0020.02511.12
4.4.30.0030.01211.12
4.4.20.0010.01011.12
4.4.10.0020.01011.12
4.4.00.0020.01311.12
4.3.110.0010.00911.12
4.3.100.0020.01511.12
4.3.90.0010.01011.12
4.3.80.0000.02211.12
4.3.70.0050.00711.12
4.3.60.0020.00811.12
4.3.50.0030.00811.12
4.3.40.0000.01511.12
4.3.30.0020.01011.12
4.3.20.0030.00811.12
4.3.10.0020.02011.12
4.3.00.0020.01511.12

preferences:
37.31 ms | 400 KiB | 5 Q