3v4l.org

run code in 300+ PHP versions simultaneously
<?php function OTP($input, $pad) { $inputlen = strlen($input); $padlen = strlen($pad); $inputbytes = unpack("C*", $input); //Pack C* will convert a string into a byte array, such as 'abc' to Array(0x61, 0x62, 0x63) $padbytes = unpack("C*", $pad); $output = ""; for($i = 0; $i < $inputlen; $i++) //Loop through the input string $output .= chr($inputbytes[$i + 1] ^ $padbytes[$i % $padlen + 1]); return $output; } $result = OTP("This is a long sentence", "Abc"); $bytes = unpack("C*", $result); echo "Bytes: "; foreach($bytes as $byte) echo $byte . " "; echo "\nEncrypted string: "; echo $result;

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.0120.00918.43
8.3.50.0070.01421.97
8.3.40.0090.01218.97
8.3.30.0070.00719.18
8.3.20.0070.00020.34
8.3.10.0030.00623.70
8.3.00.0080.00019.12
8.2.180.0120.00318.13
8.2.170.0140.00022.96
8.2.160.0100.00322.13
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00419.66
8.2.110.0070.00421.01
8.2.100.0080.00317.91
8.2.90.0050.00317.75
8.2.80.0080.00018.69
8.2.70.0040.00417.75
8.2.60.0030.00617.63
8.2.50.0040.00417.55
8.2.40.0000.00719.33
8.2.30.0080.00019.21
8.2.20.0050.00317.74
8.2.10.0030.00518.20
8.2.00.0000.00717.71
8.1.280.0070.01325.92
8.1.270.0030.00619.03
8.1.260.0120.00626.35
8.1.250.0040.00428.09
8.1.240.0050.00521.96
8.1.230.0080.00420.83
8.1.220.0040.00418.72
8.1.210.0060.00318.77
8.1.200.0110.00017.48
8.1.190.0030.00617.53
8.1.180.0090.00018.10
8.1.170.0040.00418.72
8.1.160.0040.00418.81
8.1.150.0060.00318.86
8.1.140.0060.00317.46
8.1.130.0000.00717.88
8.1.120.0000.00717.38
8.1.110.0000.00717.46
8.1.100.0070.00017.48
8.1.90.0000.00817.36
8.1.80.0080.00017.36
8.1.70.0030.00317.38
8.1.60.0000.00817.64
8.1.50.0000.00817.45
8.1.40.0030.00617.49
8.1.30.0050.00317.72
8.1.20.0040.00417.69
8.1.10.0000.00717.65
8.1.00.0000.00817.40
8.0.300.0060.00319.78
8.0.290.0040.00416.75
8.0.280.0030.00318.46
8.0.270.0030.00317.27
8.0.260.0030.00317.32
8.0.250.0000.00716.98
8.0.240.0040.00416.95
8.0.230.0000.00716.85
8.0.220.0000.00716.80
8.0.210.0000.00616.80
8.0.200.0060.00316.93
8.0.190.0040.00416.89
8.0.180.0070.00016.83
8.0.170.0040.00416.94
8.0.160.0030.00316.91
8.0.150.0000.00716.85
8.0.140.0030.00316.82
8.0.130.0000.00613.37
8.0.120.0050.00316.86
8.0.110.0000.00716.79
8.0.100.0040.00416.68
8.0.90.0040.00416.91
8.0.80.0030.01216.85
8.0.70.0000.00816.89
8.0.60.0000.00716.77
8.0.50.0000.00716.87
8.0.30.0190.00317.11
8.0.20.0120.01117.40
8.0.10.0030.00517.14
8.0.00.0080.01016.62
7.4.330.0000.00515.03
7.4.320.0030.00316.66
7.4.300.0030.00316.46
7.4.290.0000.00716.61
7.4.280.0040.00416.39
7.4.270.0000.00716.53
7.4.260.0050.00216.36
7.4.250.0070.00016.33
7.4.240.0020.00516.63
7.4.230.0050.00216.54
7.4.220.0110.00716.61
7.4.210.0130.01316.69
7.4.200.0040.00416.72
7.4.160.0100.00616.60
7.4.150.0110.00617.40
7.4.140.0060.01117.86
7.4.130.0050.01316.53
7.4.120.0130.00316.42
7.4.110.0170.00716.38
7.4.100.0130.01016.43
7.4.90.0100.00716.52
7.4.80.0170.00019.39
7.4.70.0070.01016.67
7.4.60.0120.00916.58
7.4.50.0000.00716.59
7.4.40.0100.00716.56
7.4.30.0070.01316.59
7.4.00.0070.01114.96
7.3.330.0000.00513.35
7.3.320.0050.00013.23
7.3.310.0030.00316.34
7.3.300.0030.00316.26
7.3.290.0090.00516.35
7.3.280.0110.01016.37
7.3.270.0090.00917.40
7.3.260.0040.01316.44
7.3.250.0090.00816.38
7.3.240.0120.00416.30
7.3.230.0090.01516.39
7.3.210.0120.00916.48
7.3.200.0120.00919.39
7.3.190.0080.00816.56
7.3.180.0170.00016.68
7.3.170.0070.01016.30
7.3.160.0060.00916.34
7.3.120.0070.01314.75
7.3.110.0070.01115.13
7.3.100.0030.01314.86
7.3.90.0040.01115.04
7.3.80.0070.00714.83
7.3.70.0130.00314.82
7.3.60.0100.00314.78
7.3.50.0090.00614.88
7.3.40.0110.00714.82
7.3.30.0030.01014.88
7.3.20.0120.00016.73
7.3.10.0100.00316.48
7.3.00.0030.00916.79
7.2.330.0100.00716.49
7.2.320.0040.01416.56
7.2.310.0100.00716.84
7.2.300.0030.01516.71
7.2.290.0120.01116.89
7.2.250.0070.01415.12
7.2.240.0030.01715.13
7.2.230.0060.00915.28
7.2.220.0100.00315.25
7.2.210.0130.00315.14
7.2.200.0100.00615.29
7.2.190.0120.00315.22
7.2.180.0090.00915.22
7.2.170.0120.00615.09
7.2.60.0080.00317.10
7.1.330.0040.01215.86
7.1.320.0070.00715.76
7.1.310.0030.01315.45
7.1.300.0030.01015.85
7.1.290.0030.01315.70
7.1.280.0120.00315.91
7.1.270.0080.00415.67
7.1.260.0060.01015.90
7.1.200.0080.00815.13
7.1.70.0120.00617.18
7.1.60.0030.01017.12
7.1.50.0090.01216.94
7.1.00.0130.06722.31
7.0.200.0060.01016.71
7.0.140.0000.04722.09
7.0.60.0130.07019.85
7.0.50.0130.07717.72
7.0.40.0030.09020.04
7.0.30.0270.08320.07
7.0.20.0270.05320.06
7.0.10.0070.04320.33
7.0.00.0000.09020.33
5.6.280.0000.07721.08
5.6.210.0030.07020.55
5.6.200.0070.05318.16
5.6.190.0030.06720.55
5.6.180.0170.04320.77
5.6.170.0270.07720.47
5.6.160.0000.04320.56
5.6.150.0000.04718.15
5.6.140.0030.07718.13
5.6.130.0130.06018.15
5.6.120.0170.07721.01
5.6.110.0070.08721.14
5.6.100.0030.09021.00
5.6.90.0130.08020.95
5.6.80.0130.08320.39
5.5.350.0330.06320.44
5.5.340.0130.06317.95
5.5.330.0100.04020.40
5.5.320.0300.06020.26
5.5.310.0230.05320.41
5.5.300.0070.04718.02
5.5.290.0030.08317.92
5.5.280.0100.08320.81
5.5.270.0170.07320.77
5.5.260.0100.05720.80
5.5.250.0130.05720.70
5.5.240.0130.07020.16
5.4.450.0170.04019.64
5.4.440.0200.04319.27
5.4.430.0200.05019.27
5.4.420.0230.06019.56
5.4.410.0330.06319.32
5.4.400.0230.07319.14
5.4.390.0270.04318.98
5.4.380.0200.04319.07
5.4.370.0330.03719.14
5.4.360.0270.06719.09
5.4.350.0270.06019.20
5.4.340.0270.06019.14
5.4.320.0200.03318.82
5.4.310.0230.06718.99
5.4.300.0230.06018.86
5.4.290.0270.07018.91
5.4.280.0200.07019.06
5.4.270.0230.04318.85
5.4.260.0270.07319.14
5.4.250.0370.06318.86
5.4.240.0270.06719.23
5.4.230.0500.06718.98
5.4.220.0270.04018.98
5.4.210.0200.06718.97
5.4.200.0430.05318.99
5.4.190.0200.05318.84
5.4.180.0370.06319.14
5.4.170.0270.04319.07
5.4.160.0370.06719.23
5.4.150.0200.04319.20
5.4.140.0200.04316.36
5.4.130.0270.04716.51
5.4.120.0130.05316.39
5.4.110.0270.07016.50
5.4.100.0330.05716.27
5.4.90.0230.07016.27
5.4.80.0270.06316.34
5.4.70.0200.07316.54
5.4.60.0270.04716.33
5.4.50.0230.05716.43
5.4.40.0130.05016.53
5.4.30.0300.04016.51
5.4.20.0200.05016.51
5.4.10.0200.04316.34
5.4.00.0270.06316.12
5.3.290.0230.06714.75
5.3.280.0200.04314.64
5.3.270.0300.04714.59
5.3.260.0430.02314.51
5.3.250.0200.04314.53
5.3.240.0230.04314.60
5.3.230.0300.06714.68
5.3.220.0330.06014.49
5.3.210.0370.07014.57
5.3.200.0300.06014.57
5.3.190.0370.06014.48
5.3.180.0200.06014.47
5.3.170.0270.04014.46
5.3.160.0300.03014.53
5.3.150.0300.06014.68
5.3.140.0170.07714.68
5.3.130.0230.04314.59
5.3.120.0230.07714.46
5.3.110.0270.04714.55
5.3.100.0270.07314.09
5.3.90.0330.05714.06
5.3.80.0200.06014.02
5.3.70.0300.03313.94
5.3.60.0170.08014.01
5.3.50.0270.06714.00
5.3.40.0330.06713.86
5.3.30.0170.06313.91
5.3.20.0270.04313.59
5.3.10.0270.05313.58
5.3.00.0170.04313.55
5.2.170.0230.05012.24
5.2.160.0170.04312.24
5.2.150.0200.03712.24
5.2.140.0200.03312.24
5.2.130.0230.05712.24
5.2.120.0200.02712.24
5.2.110.0300.04312.24
5.2.100.0130.03312.24
5.2.90.0230.03712.24
5.2.80.0170.06012.24
5.2.70.0170.03312.24
5.2.60.0230.06012.24
5.2.50.0230.05012.24
5.2.40.0100.05012.24
5.2.30.0130.03312.24
5.2.20.0200.02312.24
5.2.10.0170.04312.24
5.2.00.0200.02712.24
5.1.60.0230.04712.24
5.1.50.0200.05012.24
5.1.40.0130.03312.24
5.1.30.0130.05712.24
5.1.20.0230.01712.24
5.1.10.0200.04312.24
5.1.00.0330.03012.24
5.0.50.0100.02712.24
5.0.40.0100.04712.24
5.0.30.0070.04712.24
5.0.20.0130.03012.24
5.0.10.0130.02012.24
5.0.00.0070.05312.24
4.4.90.0100.01712.24
4.4.80.0100.03312.24
4.4.70.0130.01712.24
4.4.60.0230.00712.24
4.4.50.0070.03712.24
4.4.40.0070.05312.24
4.4.30.0100.02012.24
4.4.20.0130.03012.24
4.4.10.0070.02312.24
4.4.00.0100.04712.24
4.3.110.0130.03312.24
4.3.100.0130.03012.24
4.3.90.0100.02312.24
4.3.80.0230.02712.24
4.3.70.0100.02312.24
4.3.60.0070.03712.24
4.3.50.0070.03012.24
4.3.40.0070.05312.24
4.3.30.0030.03012.24
4.3.20.0070.02012.24
4.3.10.0030.04012.24
4.3.00.0070.03012.24

preferences:
58.3 ms | 401 KiB | 5 Q