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.70.0040.01118.38
8.3.60.0070.01016.75
8.3.50.0200.00522.13
8.3.40.0080.00819.22
8.3.30.0140.00019.17
8.3.20.0040.00420.22
8.3.10.0080.00023.66
8.3.00.0040.00419.51
8.2.180.0090.00618.31
8.2.170.0140.00722.96
8.2.160.0100.00720.38
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0120.00626.16
8.2.120.0060.00322.27
8.2.110.0050.00522.07
8.2.100.0130.00018.09
8.2.90.0000.00819.35
8.2.80.0040.00417.97
8.2.70.0030.00617.50
8.2.60.0080.00018.05
8.2.50.0060.00318.07
8.2.40.0000.00818.16
8.2.30.0060.00318.14
8.2.20.0030.00617.96
8.2.10.0030.00518.06
8.2.00.0030.00717.95
8.1.280.0170.00325.92
8.1.270.0030.00623.84
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.82
8.1.230.0000.01119.16
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0000.00917.47
8.1.190.0060.00317.53
8.1.180.0060.00318.10
8.1.170.0040.00418.71
8.1.160.0070.00022.05
8.1.150.0040.00418.84
8.1.140.0040.00417.68
8.1.130.0000.00717.86
8.1.120.0040.00417.63
8.1.110.0080.00017.67
8.1.100.0040.00417.61
8.1.90.0000.00817.59
8.1.80.0020.00517.62
8.1.70.0030.00317.45
8.1.60.0060.00317.73
8.1.50.0040.00417.67
8.1.40.0050.00317.73
8.1.30.0030.00617.68
8.1.20.0040.00417.85
8.1.10.0030.00617.71
8.1.00.0000.00717.63
8.0.300.0040.00418.77
8.0.290.0000.00717.05
8.0.280.0030.00318.42
8.0.270.0040.00417.18
8.0.260.0030.00317.17
8.0.250.0030.00317.00
8.0.240.0000.00817.12
8.0.230.0070.00017.14
8.0.220.0000.00716.88
8.0.210.0070.00017.01
8.0.200.0020.00517.10
8.0.190.0040.00417.13
8.0.180.0050.00217.07
8.0.170.0030.00617.03
8.0.160.0000.00716.92
8.0.150.0000.00716.95
8.0.140.0040.00417.09
8.0.130.0000.00713.38
8.0.120.0080.00016.89
8.0.110.0070.00317.01
8.0.100.0000.00816.99
8.0.90.0000.00816.86
8.0.80.0090.00617.02
8.0.70.0030.00716.91
8.0.60.0000.00817.16
8.0.50.0050.00316.89
8.0.30.0050.01417.33
8.0.20.0090.01217.40
8.0.10.0040.00417.05
8.0.00.0060.01116.98
7.4.330.0030.00315.02
7.4.320.0030.00316.86
7.4.300.0000.00616.71
7.4.290.0000.00716.70
7.4.280.0080.00016.70
7.4.270.0030.00316.64
7.4.260.0040.00416.73
7.4.250.0040.00416.79
7.4.240.0010.00716.75
7.4.230.0050.00216.90
7.4.220.0070.01116.93
7.4.210.0070.00916.83
7.4.200.0040.00416.90
7.4.190.0040.00416.96
7.4.160.0090.00616.73
7.4.150.0130.00417.40
7.4.140.0120.00517.86
7.4.130.0080.01016.65
7.4.120.0080.01016.70
7.4.110.0180.00316.66
7.4.100.0110.00716.54
7.4.90.0130.00316.59
7.4.80.0070.01019.39
7.4.70.0080.00817.04
7.4.60.0070.01416.60
7.4.50.0000.00816.71
7.4.40.0030.01022.77
7.4.30.0100.00616.71
7.4.10.0120.00615.09
7.4.00.0050.01015.16
7.3.330.0030.00313.32
7.3.320.0030.00313.45
7.3.310.0000.00716.40
7.3.300.0000.00716.47
7.3.290.0100.00316.50
7.3.280.0050.01216.54
7.3.270.0090.01117.40
7.3.260.0110.00616.54
7.3.250.0090.00916.64
7.3.240.0120.01016.48
7.3.230.0090.01416.55
7.3.210.0100.00716.48
7.3.200.0170.00719.39
7.3.190.0060.01016.58
7.3.180.0060.00916.71
7.3.170.0140.00416.55
7.3.160.0040.01616.45
7.3.130.0090.00914.64
7.3.120.0070.01115.03
7.3.110.0080.00815.08
7.3.100.0060.01014.85
7.3.90.0070.01015.07
7.3.80.0040.00815.14
7.3.70.0100.00315.00
7.3.60.0070.00715.17
7.3.50.0060.01014.72
7.3.40.0050.00814.97
7.3.30.0000.01614.90
7.3.20.0040.01117.04
7.3.10.0030.01016.95
7.3.00.0090.00517.02
7.2.330.0060.01616.69
7.2.320.0120.01216.86
7.2.310.0120.00716.88
7.2.300.0110.00716.82
7.2.290.0140.00717.02
7.2.260.0110.00715.09
7.2.250.0070.01015.51
7.2.240.0100.00815.15
7.2.230.0060.01015.38
7.2.220.0050.01215.26
7.2.210.0060.01115.32
7.2.200.0060.00715.21
7.2.190.0100.00715.33
7.2.180.0060.00715.38
7.2.170.0030.01015.33
7.2.160.0030.01315.32
7.2.150.0080.00917.17
7.2.140.0040.00617.06
7.2.130.0070.01017.16
7.2.120.0060.01117.17
7.2.110.0060.01017.14
7.2.100.0050.00917.07
7.2.90.0080.00717.00
7.2.80.0050.00917.18
7.2.70.0070.00916.98
7.2.60.0030.01217.09
7.2.50.0060.00817.22
7.2.40.0070.00917.02
7.2.30.0040.00917.26
7.2.20.0020.01417.23
7.2.10.0080.00817.03
7.2.00.0060.00817.89
7.1.330.0090.00715.92
7.1.320.0050.00815.98
7.1.310.0050.00516.17
7.1.300.0050.01216.09
7.1.290.0020.01416.06
7.1.280.0050.00715.79
7.1.270.0070.00716.00
7.1.260.0000.01115.83
7.1.250.0040.00915.82
7.1.240.0110.00416.15
7.1.230.0070.00715.98
7.1.220.0090.00015.93
7.1.210.0040.00415.96
7.1.200.0030.00915.95
7.1.190.0070.00716.04
7.1.180.0090.00315.94
7.1.170.0000.01315.97
7.1.160.0070.01015.92
7.1.150.0060.00615.88
7.1.140.0100.00716.18
7.1.130.0030.00915.79
7.1.120.0070.00715.97
7.1.110.0000.01115.66
7.1.100.0050.00817.10
7.1.90.0070.01016.04
7.1.80.0100.00716.12
7.1.70.0070.00716.71
7.1.60.0080.00717.62
7.1.50.0100.00716.67
7.1.40.0090.00616.08
7.1.30.0030.00716.06
7.1.20.0060.00315.91
7.1.10.0070.00715.92
7.1.00.0040.04119.15
7.0.330.0030.01315.41
7.0.320.0080.00815.66
7.0.310.0070.00715.53
7.0.300.0000.00915.34
7.0.290.0040.01115.46
7.0.280.0060.00615.66
7.0.270.0060.00915.46
7.0.260.0030.00615.29
7.0.250.0070.00815.38
7.0.240.0090.00615.74
7.0.230.0000.01115.63
7.0.220.0090.00315.40
7.0.210.0070.00715.36
7.0.200.0190.01015.39
7.0.190.0040.00415.73
7.0.180.0090.00415.57
7.0.170.0000.01215.55
7.0.160.0040.00815.48
7.0.150.0090.00315.71
7.0.140.0020.04318.87
7.0.130.0030.01015.68
7.0.120.0040.01115.55
7.0.110.0150.03717.64
7.0.100.0110.02617.86
7.0.90.0220.05017.66
7.0.80.0070.04817.81
7.0.70.0030.02417.84
7.0.60.0030.03717.82
7.0.50.0030.04417.99
7.0.40.0070.04516.84
7.0.30.0050.04816.89
7.0.20.0080.03716.77
7.0.10.0060.04616.76
7.0.00.0030.05016.96
5.6.400.0070.00714.43
5.6.390.0100.00314.26
5.6.380.0100.00614.65
5.6.370.0040.01114.33
5.6.360.0000.01614.57
5.6.350.0100.00014.23
5.6.340.0000.01214.03
5.6.330.0090.00614.69
5.6.320.0110.00414.53
5.6.310.0040.00814.32
5.6.300.0110.00414.48
5.6.290.0030.01114.74
5.6.280.0090.03317.69
5.6.270.0030.00714.31
5.6.260.0070.04017.57
5.6.250.0090.04317.51
5.6.240.0050.04717.49
5.6.230.0060.04817.49
5.6.220.0090.04217.49
5.6.210.0000.05117.48
5.6.200.0060.04617.93
5.6.190.0060.04717.93
5.6.180.0010.04617.81
5.6.170.0080.02817.86
5.6.160.0070.03917.77
5.6.150.0080.04317.73
5.6.140.0100.04317.78
5.6.130.0100.04117.77
5.6.120.0060.02717.66
5.6.110.0050.04817.60
5.6.100.0110.04517.78
5.6.90.0090.04417.62
5.6.80.0070.02917.37
5.6.70.0090.04017.60
5.6.60.0080.02817.29
5.6.50.0050.04817.47
5.6.40.0020.05217.51
5.6.30.0050.04517.53
5.6.20.0080.04217.48
5.6.10.0040.04417.44
5.6.00.0100.03417.31
5.5.380.0100.04017.63
5.5.370.0080.04317.34
5.5.360.0070.02717.22
5.5.350.0060.03317.37
5.5.340.0050.04217.66
5.5.330.0070.04617.54
5.5.320.0080.03717.74
5.5.310.0100.03717.44
5.5.300.0100.03817.66
5.5.290.0080.04317.77
5.5.280.0050.03817.83
5.5.270.0070.04617.63
5.5.260.0050.04317.66
5.5.250.0070.03917.60
5.5.240.0050.04417.29
5.5.230.0100.04017.27
5.5.220.0120.03817.17
5.5.210.0050.03817.14
5.5.200.0080.04117.22
5.5.190.0100.04317.33
5.5.180.0120.03817.16
5.5.170.0030.01314.23
5.5.160.0050.03317.31
5.5.150.0070.04117.24
5.5.140.0090.04117.26
5.5.130.0050.04317.19
5.5.120.0040.04017.23
5.5.110.0070.04517.38
5.5.100.0050.04417.34
5.5.90.0050.04217.27
5.5.80.0120.03817.26
5.5.70.0130.03617.18
5.5.60.0060.04117.29
5.5.50.0030.04617.24
5.5.40.0030.04517.34
5.5.30.0130.03617.25
5.5.20.0060.04217.25
5.5.10.0070.04817.28
5.5.00.0090.03717.12
5.4.450.0030.04115.45
5.4.440.0020.04715.39
5.4.430.0030.02715.34
5.4.420.0050.04215.33
5.4.410.0070.04015.34
5.4.400.0110.03615.30
5.4.390.0070.04015.24
5.4.380.0120.03315.29
5.4.370.0020.04215.18
5.4.360.0100.03515.19
5.4.350.0020.04015.19
5.4.340.0050.03315.17
5.4.330.0000.00611.34
5.4.320.0070.04015.36
5.4.310.0080.03815.15
5.4.300.0030.03815.24
5.4.290.0050.04015.24
5.4.280.0050.04015.16
5.4.270.0030.04215.28
5.4.260.0040.03915.33
5.4.250.0060.03215.24
5.4.240.0070.03215.32
5.4.230.0100.03515.31
5.4.220.0060.03815.25
5.4.210.0060.03515.18
5.4.200.0070.03815.16
5.4.190.0050.04015.24
5.4.180.0000.04715.17
5.4.170.0030.02815.18
5.4.160.0100.03815.15
5.4.150.0070.03915.32
5.4.140.0050.03813.95
5.4.130.0070.02813.84
5.4.120.0070.03513.92
5.4.110.0030.04113.83
5.4.100.0080.03713.95
5.4.90.0030.03713.95
5.4.80.0070.03813.87
5.4.70.0050.04113.87
5.4.60.0050.02513.91
5.4.50.0070.03713.91
5.4.40.0030.03413.96
5.4.30.0130.03313.91
5.4.20.0090.02913.84
5.4.10.0080.03813.94
5.4.00.0090.03613.65
5.3.290.0050.04313.07
5.3.280.0120.03713.03
5.3.270.0050.04112.95
5.3.260.0050.03913.04
5.3.250.0050.02613.01
5.3.240.0070.03812.97
5.3.230.0080.04013.03
5.3.220.0070.02513.00
5.3.210.0030.04512.93
5.3.200.0080.03812.94
5.3.190.0020.02813.07
5.3.180.0100.03513.07
5.3.170.0070.03812.96
5.3.160.0070.03712.97
5.3.150.0030.04113.07
5.3.140.0070.03712.94
5.3.130.0050.04213.01
5.3.120.0030.04012.87
5.3.110.0070.03612.92
5.3.100.0030.03512.71
5.3.90.0020.04212.73
5.3.80.0050.02312.72
5.3.70.0060.04012.70
5.3.60.0070.04212.67
5.3.50.0080.03512.65
5.3.40.0090.03512.65
5.3.30.0120.03312.64
5.3.20.0050.02212.59
5.3.10.0040.04112.51
5.3.00.0020.03212.56
5.2.170.0100.03312.09
5.2.160.0000.03712.09
5.2.150.0030.03712.09
5.2.140.0070.05712.09
5.2.130.0070.05712.09
5.2.120.0030.06012.09
5.2.110.0130.05312.09
5.2.100.0030.06012.09
5.2.90.0070.03012.09
5.2.80.0100.05712.09
5.2.70.0030.06712.09
5.2.60.0000.04312.09
5.2.50.0000.06712.09
5.2.40.0100.05712.09
5.2.30.0200.05012.09
5.2.20.0030.06012.09
5.2.10.0030.06012.09
5.2.00.0100.05312.09
5.1.60.0030.05312.09
5.1.50.0030.05712.09
5.1.40.0000.05712.09
5.1.30.0030.05712.09
5.1.20.0100.04712.09
5.1.10.0030.05712.09
5.1.00.0070.05012.09
5.0.50.0000.04312.09
5.0.40.0070.04312.09
5.0.30.0000.06012.09
5.0.20.0100.04012.09
5.0.10.0000.03712.09
5.0.00.0030.06312.09
4.4.90.0000.02712.09
4.4.80.0030.03312.09
4.4.70.0030.02012.09
4.4.60.0030.03312.09
4.4.50.0070.02712.09
4.4.40.0030.04312.09
4.4.30.0000.03712.09
4.4.20.0070.03012.09
4.4.10.0070.03312.09
4.4.00.0030.05312.09
4.3.110.0030.03312.09
4.3.100.0030.03312.09
4.3.90.0030.03312.09
4.3.80.0030.05712.09
4.3.70.0030.03312.09
4.3.60.0030.02712.09
4.3.50.0030.03712.09
4.3.40.0000.03012.09
4.3.30.0000.04012.09
4.3.20.0030.03312.09
4.3.10.0030.03312.09
4.3.00.0000.03712.09

preferences:
55.36 ms | 401 KiB | 5 Q