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.0030.01718.55
8.3.60.0150.00616.63
8.3.50.0170.00117.46
8.3.40.0120.00318.87
8.3.30.0070.00718.88
8.3.20.0080.00018.89
8.3.10.0030.00620.95
8.3.00.0030.00519.50
8.2.180.0070.01018.31
8.2.170.0060.01222.96
8.2.160.0100.00322.38
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0000.00826.16
8.2.120.0060.00319.85
8.2.110.0080.00822.16
8.2.100.0120.00017.97
8.2.90.0040.00419.52
8.2.80.0060.00319.34
8.2.70.0000.00817.62
8.2.60.0000.00817.91
8.2.50.0000.00918.07
8.2.40.0040.00418.03
8.2.30.0030.00718.10
8.2.20.0000.00717.87
8.2.10.0000.00717.99
8.2.00.0000.00717.89
8.1.280.0090.00925.92
8.1.270.0070.00024.66
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00023.91
8.1.230.0110.00023.93
8.1.220.0030.00517.88
8.1.210.0050.00318.89
8.1.200.0060.00317.48
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0000.00918.81
8.1.160.0040.00418.91
8.1.150.0070.00018.70
8.1.140.0040.00417.67
8.1.130.0030.00317.96
8.1.120.0000.00717.50
8.1.110.0000.00817.57
8.1.100.0050.00217.66
8.1.90.0040.00417.63
8.1.80.0050.00317.61
8.1.70.0000.00717.53
8.1.60.0040.00417.75
8.1.50.0000.00717.58
8.1.40.0060.00317.60
8.1.30.0080.00017.82
8.1.20.0080.00017.84
8.1.10.0030.00517.58
8.1.00.0040.00417.59
8.0.300.0040.00419.88
8.0.290.0070.00016.88
8.0.280.0040.00418.34
8.0.270.0050.00217.32
8.0.260.0070.00016.89
8.0.250.0070.00017.12
8.0.240.0040.00417.04
8.0.230.0030.00417.16
8.0.220.0040.00417.06
8.0.210.0040.00417.07
8.0.200.0030.00317.14
8.0.190.0070.00016.99
8.0.180.0000.00717.03
8.0.170.0050.00516.98
8.0.160.0000.00816.93
8.0.150.0040.00416.98
8.0.140.0000.00717.05
8.0.130.0030.00313.51
8.0.120.0000.00716.91
8.0.110.0070.00016.88
8.0.100.0030.00416.89
8.0.90.0070.00017.00
8.0.80.0060.01016.98
8.0.70.0070.00016.84
8.0.60.0000.00816.89
8.0.50.0040.00417.06
8.0.30.0090.01217.26
8.0.20.0100.01217.31
8.0.10.0050.00317.02
8.0.00.0140.00516.88
7.4.330.0000.00513.14
7.4.320.0000.00616.78
7.4.300.0000.00716.72
7.4.290.0030.00316.72
7.4.280.0040.00416.72
7.4.270.0000.00716.64
7.4.260.0000.00813.49
7.4.250.0050.00316.62
7.4.240.0040.00416.61
7.4.230.0070.00016.82
7.4.220.0070.01116.71
7.4.210.0100.00716.79
7.4.200.0000.00716.87
7.4.190.0030.00516.69
7.4.160.0070.01016.55
7.4.150.0060.01216.71
7.4.140.0080.01216.78
7.4.130.0150.00516.59
7.4.120.0090.00916.79
7.4.110.0110.00916.53
7.4.100.0090.00916.78
7.4.90.0140.00416.68
7.4.80.0060.01116.84
7.4.70.0120.00616.50
7.4.60.0070.01016.78
7.4.50.0060.00316.79
7.4.40.0100.00716.56
7.4.30.0100.00716.57
7.4.10.0130.00715.21
7.4.00.0040.01415.08
7.3.330.0030.00313.27
7.3.320.0050.00013.37
7.3.310.0000.00816.47
7.3.300.0040.00416.48
7.3.290.0110.00416.40
7.3.280.0030.01216.53
7.3.270.0130.01016.73
7.3.260.0090.00916.54
7.3.250.0090.01216.65
7.3.240.0080.00816.44
7.3.230.0060.01216.76
7.3.210.0030.01316.80
7.3.200.0120.00619.39
7.3.190.0150.00616.68
7.3.180.0060.01316.53
7.3.170.0070.01016.63
7.3.160.0140.00316.56
7.3.130.0080.00814.93
7.3.120.0100.00515.09
7.3.110.0110.00415.04
7.3.100.0060.00814.94
7.3.90.0020.01215.09
7.3.80.0050.00715.09
7.3.70.0110.00214.92
7.3.60.0090.00915.06
7.3.50.0050.01014.90
7.3.40.0040.00614.80
7.3.30.0090.00714.85
7.3.20.0060.00916.78
7.3.10.0050.01116.71
7.3.00.0070.00316.93
7.2.330.0100.01016.67
7.2.320.0090.01217.02
7.2.310.0080.01217.05
7.2.300.0060.00917.09
7.2.290.0080.00816.82
7.2.260.0070.00715.31
7.2.250.0060.01215.22
7.2.240.0090.00515.30
7.2.230.0060.00715.16
7.2.220.0050.00715.36
7.2.210.0080.00815.13
7.2.200.0080.00815.23
7.2.190.0030.01315.32
7.2.180.0080.00515.28
7.2.170.0060.00815.20
7.2.160.0120.00315.48
7.2.150.0040.01217.01
7.2.140.0060.00917.16
7.2.130.0000.01117.13
7.2.120.0000.01217.20
7.2.110.0030.00716.96
7.2.100.0000.01516.88
7.2.90.0070.00317.18
7.2.80.0070.00717.15
7.2.70.0040.00716.92
7.2.60.0050.01017.13
7.2.50.0060.00916.91
7.2.40.0090.00617.21
7.2.30.0000.01417.23
7.2.20.0070.00717.20
7.2.10.0000.00917.14
7.2.00.0060.01018.31
7.1.330.0030.01015.91
7.1.320.0060.00815.79
7.1.310.0080.00515.94
7.1.300.0080.00716.11
7.1.290.0080.00516.06
7.1.280.0030.01016.04
7.1.270.0070.00716.12
7.1.260.0030.01316.01
7.1.250.0030.00616.01
7.1.240.0100.00315.89
7.1.230.0000.01416.07
7.1.220.0030.01416.02
7.1.210.0060.00316.03
7.1.200.0040.01016.12
7.1.190.0060.00615.70
7.1.180.0030.00615.98
7.1.170.0000.00815.86
7.1.160.0070.00716.19
7.1.150.0000.01316.06
7.1.140.0030.01016.17
7.1.130.0060.00616.18
7.1.120.0060.00616.04
7.1.110.0030.00615.88
7.1.100.0020.01117.26
7.1.90.0030.00615.90
7.1.80.0070.00315.93
7.1.70.0020.01316.76
7.1.60.0080.00917.69
7.1.50.0060.00916.63
7.1.40.0080.00315.98
7.1.30.0000.01315.79
7.1.20.0030.01016.00
7.1.10.0030.00815.89
7.1.00.0030.03219.20
7.0.330.0060.00615.52
7.0.320.0070.01015.38
7.0.310.0030.01015.50
7.0.300.0040.00415.64
7.0.290.0060.00915.59
7.0.280.0000.01015.65
7.0.270.0060.00315.83
7.0.260.0060.00315.52
7.0.250.0040.00415.48
7.0.240.0030.01015.57
7.0.230.0030.01015.70
7.0.220.0070.00715.36
7.0.210.0030.01015.59
7.0.200.0200.00715.18
7.0.190.0100.00015.64
7.0.180.0040.00815.42
7.0.170.0040.00815.73
7.0.160.0030.01215.49
7.0.150.0040.01215.55
7.0.140.0030.04018.83
7.0.130.0070.00715.52
7.0.120.0060.03718.77
7.0.110.0070.00715.61
7.0.100.0080.00015.63
7.0.90.0100.00015.45
7.0.80.0080.00815.50
7.0.70.0000.00815.67
7.0.60.0160.02818.63
7.0.50.0110.04016.77
7.0.40.0150.04816.98
7.0.30.0210.04116.94
7.0.20.0220.02216.97
7.0.10.0150.02516.95
7.0.00.0240.03617.04
5.6.400.0060.00614.51
5.6.390.0030.00714.23
5.6.380.0000.00914.58
5.6.370.0030.01214.02
5.6.360.0070.00714.16
5.6.350.0070.00714.60
5.6.340.0030.01214.56
5.6.330.0030.00814.75
5.6.320.0040.01114.41
5.6.310.0070.01314.21
5.6.300.0060.00314.67
5.6.290.0030.01014.93
5.6.280.0080.03817.60
5.6.270.0060.00614.22
5.6.260.0080.00614.57
5.6.250.0060.00614.37
5.6.240.0080.00014.62
5.6.230.0150.00014.67
5.6.220.0000.01214.58
5.6.210.0230.03217.49
5.6.200.0080.03516.26
5.6.190.0170.04717.60
5.6.180.0220.03817.58
5.6.170.0180.02717.64
5.6.160.0180.02317.46
5.6.150.0160.02517.44
5.6.140.0230.02217.34
5.6.130.0220.03317.65
5.6.120.0250.03817.35
5.6.110.0180.03617.56
5.6.100.0200.04317.27
5.6.90.0220.03917.27
5.6.80.0240.03816.97
5.6.70.0220.02217.24
5.6.60.0120.02417.10
5.6.50.0100.02517.18
5.6.40.0080.02617.06
5.6.30.0080.02617.19
5.6.20.0100.02417.02
5.6.10.0130.02316.98
5.6.00.0120.02217.06
5.5.380.0060.00914.41
5.5.370.0070.01014.60
5.5.360.0040.01114.63
5.5.350.0100.04717.43
5.5.340.0090.02016.22
5.5.330.0160.04317.50
5.5.320.0150.04217.53
5.5.310.0160.03117.57
5.5.300.0160.04317.24
5.5.290.0190.03817.42
5.5.280.0200.04117.08
5.5.270.0180.02717.24
5.5.260.0220.04017.52
5.5.250.0200.03817.02
5.5.240.0250.02317.15
5.5.230.0150.02616.98
5.5.220.0120.02717.06
5.5.210.0100.02717.04
5.5.200.0130.02216.87
5.5.190.0150.01916.85
5.5.180.0130.02316.84
5.5.170.0040.01414.45
5.5.160.0140.02216.92
5.5.150.0110.02316.84
5.5.140.0130.02316.84
5.5.130.0120.02317.01
5.5.120.0150.02217.00
5.5.110.0120.02316.77
5.5.100.0130.02316.75
5.5.90.0130.02016.87
5.5.80.0150.02016.74
5.5.70.0150.02116.88
5.5.60.0090.02616.92
5.5.50.0100.02716.85
5.5.40.0080.02616.89
5.5.30.0200.01816.80
5.5.20.0130.02716.98
5.5.10.0120.02616.98
5.5.00.0200.03316.86
5.4.450.0260.03015.48
5.4.440.0120.03915.31
5.4.430.0190.03915.34
5.4.420.0210.03015.43
5.4.410.0170.02715.41
5.4.400.0130.03215.16
5.4.390.0120.02315.24
5.4.380.0180.01514.91
5.4.370.0100.02315.11
5.4.360.0120.02615.22
5.4.350.0150.01715.07
5.4.340.0160.01615.07
5.4.330.0030.01011.50
5.4.320.0130.02015.30
5.4.310.0090.02315.07
5.4.300.0130.02215.01
5.4.290.0130.02015.08
5.4.280.0070.02314.89
5.4.270.0100.02015.16
5.4.260.0150.01815.22
5.4.250.0130.02114.95
5.4.240.0120.02215.13
5.4.230.0150.01815.19
5.4.220.0140.02215.14
5.4.210.0120.02015.08
5.4.200.0150.02015.25
5.4.190.0100.02314.99
5.4.180.0120.02214.87
5.4.170.0170.03515.07
5.4.160.0170.03115.26
5.4.150.0170.04215.20
5.4.140.0210.02313.76
5.4.130.0170.02313.64
5.4.120.0080.03813.77
5.4.110.0120.02113.86
5.4.100.0160.03813.81
5.4.90.0190.03613.75
5.4.80.0200.02013.85
5.4.70.0190.03613.63
5.4.60.0220.02913.81
5.4.50.0130.02013.90
5.4.40.0150.03813.69
5.4.30.0180.03313.70
5.4.20.0180.02513.99
5.4.10.0180.04013.96
5.4.00.0150.03413.53
5.3.290.0140.01912.82
5.3.280.0120.01912.51
5.3.270.0080.02512.71
5.3.260.0130.02712.69
5.3.250.0150.03212.65
5.3.240.0150.02212.64
5.3.230.0060.04112.52
5.3.220.0250.03012.62
5.3.210.0150.02212.60
5.3.200.0100.02312.59
5.3.190.0250.02912.55
5.3.180.0170.03312.66
5.3.170.0190.03912.72
5.3.160.0150.03012.58
5.3.150.0180.02012.61
5.3.140.0180.02212.56
5.3.130.0200.02312.60
5.3.120.0160.04112.54
5.3.110.0160.04012.63
5.3.100.0130.03812.27
5.3.90.0130.04312.38
5.3.80.0150.03112.30
5.3.70.0230.03312.37
5.3.60.0200.03612.39
5.3.50.0150.02212.16
5.3.40.0150.04412.24
5.3.30.0210.03112.18
5.3.20.0080.03112.20
5.3.10.0150.03812.00
5.3.00.0170.03011.98
5.2.170.0230.06312.38
5.2.160.0230.03712.38
5.2.150.0270.06012.38
5.2.140.0200.06312.38
5.2.130.0370.04712.38
5.2.120.0230.06012.38
5.2.110.0230.03312.38
5.2.100.0270.06012.38
5.2.90.0230.05312.38
5.2.80.0170.03312.38
5.2.70.0200.03012.38
5.2.60.0270.06012.38
5.2.50.0300.05712.38
5.2.40.0170.03312.38
5.2.30.0200.06012.38
5.2.20.0300.04712.38
5.2.10.0230.03312.38
5.2.00.0270.05012.38
5.1.60.0170.04012.38
5.1.50.0230.04712.38
5.1.40.0230.01712.38
5.1.30.0230.03712.38
5.1.20.0030.02712.38
5.1.10.0030.04012.38
5.1.00.0000.04012.38
5.0.50.0030.03712.38
5.0.40.0200.02012.38
5.0.30.0000.06312.38
5.0.20.0000.04012.38
5.0.10.0000.03712.38
5.0.00.0000.04012.38
4.4.90.0170.02712.38
4.4.80.0100.03712.38
4.4.70.0070.03712.38
4.4.60.0100.03312.38
4.4.50.0100.03312.38
4.4.40.0130.03312.38
4.4.30.0070.02012.38
4.4.20.0000.01712.38
4.4.10.0000.03712.38
4.4.00.0000.04312.38
4.3.110.0130.01312.38
4.3.100.0070.03712.38
4.3.90.0070.03012.38
4.3.80.0030.05012.38
4.3.70.0100.02712.38
4.3.60.0030.03012.38
4.3.50.0070.03312.38
4.3.40.0070.04312.38
4.3.30.0000.04012.38
4.3.20.0000.04012.38
4.3.10.0000.04012.38
4.3.00.0000.04012.38

preferences:
49.66 ms | 401 KiB | 5 Q