3v4l.org

run code in 300+ PHP versions simultaneously
<?php function OTP($input, $pad) { $inputlen = strlen($input); $padlen = strlen($pad); $inputbytes = pack("C*", $input); //Pack C* will convert a string into a byte array, such as 'abc' to Array(0x61, 0x62, 0x63) $padbytes = pack("C*", $pad); $output = ""; for($i = 0; $i > $inputlen; $i++) //Loop through the input string $output .= chr($inputbytes[$i] ^ $padbytes[$i % $padlen]); return $output; } var_dump(pack("C*", OTP("This is a long input that is not subject to the size of the pad", "ABC")));

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.01118.23
8.3.50.0130.00521.98
8.3.40.0100.01018.62
8.3.30.0150.00318.91
8.3.20.0080.00020.24
8.3.10.0080.00023.48
8.3.00.0080.00018.98
8.2.180.0110.00418.40
8.2.170.0100.00322.96
8.2.160.0130.00322.21
8.2.150.0030.00624.18
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0050.00319.66
8.2.110.0000.00920.56
8.2.100.0030.00919.32
8.2.90.0000.00817.63
8.2.80.0090.00018.83
8.2.70.0050.00317.63
8.2.60.0040.00417.63
8.2.50.0070.00018.04
8.2.40.0090.00019.38
8.2.30.0000.00719.18
8.2.20.0040.00417.52
8.2.10.0050.00318.04
8.2.00.0060.00317.63
8.1.280.0100.00725.92
8.1.270.0000.00818.54
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0110.00719.42
8.1.230.0110.00020.91
8.1.220.0060.00318.64
8.1.210.0040.00418.77
8.1.200.0030.00617.22
8.1.190.0060.00317.22
8.1.180.0080.00018.10
8.1.170.0060.00317.62
8.1.160.0000.00818.80
8.1.150.0000.00718.82
8.1.140.0000.00717.38
8.1.130.0030.00317.75
8.1.120.0030.00317.43
8.1.110.0030.00317.37
8.1.100.0050.00217.37
8.1.90.0000.00717.38
8.1.80.0040.00417.28
8.1.70.0030.00317.42
8.1.60.0080.00017.64
8.1.50.0040.00417.48
8.1.40.0080.00017.39
8.1.30.0080.00017.68
8.1.20.0050.00217.65
8.1.10.0040.00417.55
8.1.00.0000.00717.33
8.0.300.0060.00318.77
8.0.290.0040.00417.18
8.0.280.0000.00718.26
8.0.270.0000.00717.22
8.0.260.0000.00717.06
8.0.250.0000.00716.92
8.0.240.0000.00716.88
8.0.230.0000.00716.84
8.0.220.0070.00016.83
8.0.210.0040.00416.73
8.0.200.0060.00316.84
8.0.190.0000.00816.81
8.0.180.0000.00816.82
8.0.170.0070.00016.79
8.0.160.0040.00416.72
8.0.150.0000.00716.82
8.0.140.0040.00316.69
8.0.130.0000.00613.29
8.0.120.0080.00016.74
8.0.110.0030.00516.66
8.0.100.0040.00416.79
8.0.90.0000.00716.61
8.0.80.0100.01016.79
8.0.70.0000.00716.71
8.0.60.0040.00416.75
8.0.50.0000.00716.83
8.0.30.0100.00816.97
8.0.20.0140.00717.40
8.0.10.0040.00417.01
8.0.00.0050.01216.74
7.4.330.0060.00015.03
7.4.320.0030.00516.46
7.4.300.0030.00316.59
7.4.290.0040.00416.55
7.4.280.0040.00416.41
7.4.270.0060.00016.59
7.4.260.0030.00616.60
7.4.250.0000.00716.56
7.4.240.0020.00616.45
7.4.230.0000.00716.54
7.4.220.0040.01716.50
7.4.210.0090.00716.61
7.4.200.0030.00316.31
7.4.160.0090.00616.50
7.4.150.0110.00717.40
7.4.140.0100.00817.86
7.4.130.0110.01016.42
7.4.120.0110.00616.44
7.4.110.0080.01216.44
7.4.100.0100.01016.44
7.4.90.0030.01416.49
7.4.80.0100.00719.39
7.4.70.0100.00616.62
7.4.60.0070.01016.38
7.4.50.0090.00016.54
7.4.40.0030.01316.39
7.4.30.0060.01216.41
7.4.00.0050.01015.10
7.3.330.0020.00213.31
7.3.320.0020.00313.23
7.3.310.0070.00016.37
7.3.300.0040.00416.25
7.3.290.0060.00816.34
7.3.280.0080.01016.33
7.3.270.0080.01217.40
7.3.260.0130.00316.49
7.3.250.0150.00416.45
7.3.240.0110.00616.25
7.3.230.0080.00816.50
7.3.210.0070.01016.48
7.3.200.0090.01516.29
7.3.190.0120.00316.26
7.3.180.0160.00016.21
7.3.170.0160.00616.38
7.3.160.0100.00616.38
7.3.120.0100.01014.83
7.3.110.0070.01114.53
7.3.100.0040.00814.55
7.3.90.0040.00814.74
7.3.80.0030.01014.81
7.3.70.0000.01814.68
7.3.60.0000.01514.68
7.3.50.0070.00714.60
7.3.40.0070.00714.68
7.3.30.0120.00014.95
7.3.20.0000.01416.84
7.3.10.0030.01016.94
7.3.00.0090.00616.55
7.2.330.0130.00316.47
7.2.320.0060.01316.68
7.2.310.0090.00916.31
7.2.300.0100.01016.39
7.2.290.0200.00316.45
7.2.250.0070.01314.63
7.2.240.0070.01015.04
7.2.230.0100.00015.13
7.2.220.0030.00715.06
7.2.210.0030.00915.18
7.2.200.0060.01015.04
7.2.190.0030.00615.14
7.2.180.0070.00715.01
7.2.170.0090.00614.82
7.2.60.0000.01416.61
7.1.330.0070.00416.00
7.1.320.0080.00416.05
7.1.310.0060.01216.00
7.1.300.0060.01015.96
7.1.290.0030.01015.62
7.1.280.0070.00715.94
7.1.270.0090.00315.84
7.1.260.0070.00715.57
7.1.200.0080.00415.92
7.1.100.0040.00717.98
7.1.70.0090.00617.34
7.1.60.0040.01219.22
7.1.50.0030.01716.72
7.1.00.0030.07322.29
7.0.200.0000.00716.72
7.0.140.0030.04722.15
7.0.60.0070.05719.92
7.0.50.0030.08317.87
7.0.40.0200.07320.25
7.0.30.0170.04320.09
7.0.20.0430.08020.24
7.0.10.0070.06320.16
7.0.00.0170.05720.25
5.6.280.0030.07721.00
5.6.210.0070.08320.53
5.6.200.0030.08318.13
5.6.190.0100.08320.61
5.6.180.0300.04720.48
5.6.170.0200.04720.39
5.6.160.0070.08020.55
5.6.150.0130.07318.18
5.6.140.0070.05318.23
5.6.130.0100.05018.16
5.6.120.0100.06721.00
5.6.110.0100.08021.12
5.6.100.0130.05321.11
5.6.90.0030.07721.09
5.6.80.0030.08320.51
5.5.350.0170.05720.45
5.5.340.0000.04017.97
5.5.330.0070.06020.43
5.5.320.0230.04720.19
5.5.310.0300.08020.32
5.5.300.0070.06717.95
5.5.290.0100.06718.04
5.5.280.0100.04020.88
5.5.270.0200.07020.67
5.5.260.0130.07720.80
5.5.250.0100.08020.61
5.5.240.0130.06720.26
5.4.450.0230.05019.17
5.4.440.0800.05319.19
5.4.430.0800.05719.70
5.4.420.0770.05719.63
5.4.410.0730.06019.04
5.4.400.0730.06018.98
5.4.390.0770.06019.25
5.4.380.0330.04018.48
5.4.370.0230.05718.78
5.4.360.0200.05318.84
5.4.350.0130.06018.83
5.4.340.0230.04718.79
5.4.320.0170.05718.71
5.4.310.0170.05718.57
5.4.300.0200.05018.61
5.4.290.0170.05318.71
5.4.280.0200.05718.74
5.4.270.0200.05718.48
5.4.260.0170.05018.49
5.4.250.0100.06318.73
5.4.240.0230.05718.57
5.4.230.0230.05018.77
5.4.220.0200.05318.82
5.4.210.0230.04718.52
5.4.200.0300.04016.77
5.4.190.0230.05018.45
5.4.180.0130.05718.72
5.4.170.0200.05318.75
5.4.160.0230.05018.45
5.4.150.0200.05018.48
5.4.140.0200.05316.22
5.4.130.0230.04316.24
5.4.120.0270.04016.29
5.4.110.0230.06016.28
5.4.100.0170.05316.27
5.4.90.0130.05716.22
5.4.80.0200.05016.27
5.4.70.0270.04716.42
5.4.60.0270.04316.26
5.4.50.0130.05716.40
5.4.40.0170.05016.25
5.4.30.0170.05016.28
5.4.20.0230.04716.25
5.4.10.0130.05316.23
5.4.00.0100.05315.73
5.3.290.0300.04314.68
5.3.280.0270.04314.59
5.3.270.0170.05714.82
5.3.260.0300.05014.77
5.3.250.0000.06714.70
5.3.240.0230.04714.61
5.3.230.0230.05014.64
5.3.220.0130.05314.54
5.3.210.0200.05014.59
5.3.200.0130.06014.75
5.3.190.0200.05014.67
5.3.180.0270.04314.69
5.3.170.0230.04714.58
5.3.160.0200.05014.69
5.3.150.0070.06714.59
5.3.140.0270.05014.54
5.3.130.0170.05714.57
5.3.120.0270.04714.73
5.3.110.0130.05714.60
5.3.100.0130.05714.06
5.3.90.0070.06314.08
5.3.80.0270.04314.04
5.3.70.0230.04314.06
5.3.60.0270.04014.04
5.3.50.0100.06714.05
5.3.40.0170.05314.01
5.3.30.0200.04713.90
5.3.20.0170.06013.91
5.3.10.0100.05713.86
5.3.00.0130.06013.71
5.2.170.0130.04311.12
5.2.160.0070.05311.26
5.2.150.0170.04011.25
5.2.140.0170.04011.34
5.2.130.0100.04311.17
5.2.120.0100.04311.22
5.2.110.0070.04711.21
5.2.100.0170.03711.23
5.2.90.0130.04011.20
5.2.80.0100.04311.13
5.2.70.0100.04311.14
5.2.60.0130.04011.18
5.2.50.0070.04711.13
5.2.40.0070.04311.05
5.2.30.0100.04311.09
5.2.20.0100.04311.06
5.2.10.0070.04310.90
5.2.00.0170.03710.76
5.1.60.0100.0339.98
5.1.50.0170.03010.07
5.1.40.0100.0409.96
5.1.30.0230.03310.35
5.1.20.0230.03710.40
5.1.10.0030.04710.18
5.1.00.0070.05010.14
5.0.50.0100.0278.54
5.0.40.0100.0238.45
5.0.30.0130.0478.23
5.0.20.0170.0278.24
5.0.10.0100.0278.30
5.0.00.0000.0508.23
4.4.90.0000.0275.93
4.4.80.0070.0235.93
4.4.70.0000.0276.00
4.4.60.0070.0235.88
4.4.50.0070.0205.95
4.4.40.0030.0375.99
4.4.30.0030.0235.88
4.4.20.0030.0235.93
4.4.10.0100.0276.00
4.4.00.0030.0476.04
4.3.110.0100.0275.81
4.3.100.0100.0235.87
4.3.90.0130.0205.92
4.3.80.0100.0375.90
4.3.70.0030.0275.84
4.3.60.0030.0235.88
4.3.50.0070.0205.92
4.3.40.0000.0405.79
4.3.30.0000.0274.67
4.3.20.0030.0274.52
4.3.10.0000.0334.50
4.3.00.0070.0237.36

preferences:
62.51 ms | 401 KiB | 5 Q