3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encode($string,$key) { $key = sha1($key); $strLen = strlen($string); $keyLen = strlen($key); for ($i = 0; $i < $strLen; $i++) { $ordStr = ord(substr($string,$i,1)); if ($j == $keyLen) { $j = 0; } $ordKey = ord(substr($key,$j,1)); $j++; $hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36)); } return $hash; } function decode($string,$key) { $key = sha1($key); $strLen = strlen($string); $keyLen = strlen($key); for ($i = 0; $i < $strLen; $i+=2) { $ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16)); if ($j == $keyLen) { $j = 0; } $ordKey = ord(substr($key,$j,1)); $j++; $hash .= chr($ordStr - $ordKey); } return $hash; } echo encode("Please Encode Me!","This is a key"); echo decode(encode("Please Encode Me!","This is a key")); ?>

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.40.0120.00318.92
8.3.30.0100.00320.17
8.3.20.0080.00020.66
8.3.10.0040.00420.96
8.3.00.0000.00723.57
8.2.170.0070.00722.96
8.2.160.0100.00320.37
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00421.12
8.2.110.0100.00020.57
8.2.100.0090.00317.97
8.2.90.0030.00519.35
8.2.80.0040.00418.04
8.2.70.0050.00317.75
8.2.60.0030.00618.03
8.2.50.0060.00318.07
8.2.40.0040.00418.22
8.2.30.0000.00719.47
8.2.20.0040.00417.69
8.2.10.0030.00517.85
8.2.00.0040.00417.88
8.1.270.0080.00023.99
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0090.00021.03
8.1.230.0110.00020.96
8.1.220.0040.00418.77
8.1.210.0080.00018.85
8.1.200.0060.00317.48
8.1.190.0070.00017.52
8.1.180.0080.00018.10
8.1.170.0000.00818.48
8.1.160.0000.00718.86
8.1.150.0040.00418.63
8.1.140.0040.00417.46
8.1.130.0000.00717.75
8.1.120.0000.00717.36
8.1.110.0000.00717.34
8.1.100.0000.00817.46
8.1.90.0000.00817.48
8.1.80.0000.00717.37
8.1.70.0030.00317.39
8.1.60.0030.00617.55
8.1.50.0000.00817.48
8.1.40.0030.00517.56
8.1.30.0050.00317.63
8.1.20.0000.00817.66
8.1.10.0040.00417.55
8.1.00.0080.00017.53
8.0.300.0000.00719.83
8.0.290.0000.00717.05
8.0.280.0040.00418.43
8.0.270.0030.00417.17
8.0.260.0000.01016.88
8.0.250.0000.00817.02
8.0.240.0000.00816.91
8.0.230.0030.00317.00
8.0.220.0070.00016.89
8.0.210.0030.00316.93
8.0.200.0060.00017.03
8.0.190.0080.00017.02
8.0.180.0070.00016.87
8.0.170.0050.00316.90
8.0.160.0000.00717.05
8.0.150.0040.00416.97
8.0.140.0000.01016.92
8.0.130.0060.00013.32
8.0.120.0030.00516.88
8.0.110.0000.00716.88
8.0.100.0070.00016.87
8.0.90.0040.00416.90
8.0.80.0160.00617.02
8.0.70.0000.00716.79
8.0.60.0070.00017.02
8.0.50.0030.00516.81
8.0.30.0140.00817.04
8.0.20.0110.00717.40
8.0.10.0050.00216.90
8.0.00.0060.01316.88
7.4.330.0050.00014.92
7.4.320.0000.00616.42
7.4.300.0060.00016.41
7.4.290.0000.00716.49
7.4.280.0020.00516.48
7.4.270.0040.00416.61
7.4.260.0030.00313.16
7.4.250.0040.00416.37
7.4.240.0040.00416.42
7.4.230.0030.00516.70
7.4.220.0150.00316.41
7.4.210.0060.00916.56
7.4.200.0070.00016.63
7.4.190.0000.00816.65
7.4.160.0140.00516.56
7.4.150.0100.01017.40
7.4.140.0080.01017.86
7.4.130.0070.01116.58
7.4.120.0090.00816.60
7.4.110.0110.00716.44
7.4.100.0130.00416.70
7.4.90.0060.01216.52
7.4.80.0140.00719.39
7.4.70.0080.00916.43
7.4.60.0070.01616.52
7.4.50.0030.00616.46
7.4.40.0080.00822.77
7.4.30.0090.00916.64
7.4.00.0070.00715.08
7.3.330.0020.00213.43
7.3.320.0030.00313.42
7.3.310.0070.00016.28
7.3.300.0030.00316.47
7.3.290.0030.01016.44
7.3.280.0090.01116.39
7.3.270.0100.01317.40
7.3.260.0130.00618.24
7.3.250.0120.00916.46
7.3.240.0080.00816.39
7.3.230.0060.01216.57
7.3.210.0140.00416.64
7.3.200.0120.00919.39
7.3.190.0050.01416.50
7.3.180.0060.01316.44
7.3.170.0070.00916.56
7.3.160.0160.00616.56
7.3.120.0070.01114.82
7.3.110.0090.00914.89
7.3.100.0000.01414.98
7.3.90.0040.01114.84
7.3.80.0000.00814.98
7.3.70.0060.01014.77
7.3.60.0000.01314.92
7.3.50.0100.00314.93
7.3.40.0040.00814.91
7.3.30.0030.01314.72
7.3.20.0030.00616.52
7.3.10.0070.00716.75
7.3.00.0030.01016.84
7.2.330.0140.00516.61
7.2.320.0110.00716.86
7.2.310.0150.00616.95
7.2.300.0060.01916.71
7.2.290.0070.01016.74
7.2.240.0070.01014.71
7.2.230.0030.01415.05
7.2.220.0060.00915.27
7.2.210.0040.00814.97
7.2.200.0130.00014.96
7.2.190.0000.01015.03
7.2.180.0060.00914.80
7.2.170.0070.01115.09
7.2.160.0030.01215.18
7.2.150.0030.00917.09
7.2.140.0000.01516.90
7.2.130.0060.01017.16
7.2.120.0030.00916.84
7.2.110.0030.01016.72
7.2.100.0040.00717.06
7.2.90.0040.01116.80
7.2.80.0040.01116.74
7.2.70.0000.01317.02
7.2.60.0050.00517.00
7.2.50.0030.00616.98
7.2.40.0030.01017.09
7.2.30.0040.00816.81
7.2.20.0000.00916.96
7.2.10.0070.00316.74
7.2.00.0000.01418.20
7.1.330.0000.01315.93
7.1.320.0070.00415.71
7.1.310.0080.00615.77
7.1.300.0000.01415.88
7.1.290.0040.01115.88
7.1.280.0060.00915.57
7.1.270.0060.00915.71
7.1.260.0030.00915.90
7.1.250.0090.00315.88
7.1.200.0100.00315.84
7.1.100.0000.01318.35
7.1.70.0050.00517.36
7.1.60.0060.01819.17
7.1.50.0060.01917.11
7.1.00.0070.03022.33
7.0.200.0070.00016.52
7.0.140.0000.09721.95
7.0.80.0270.03719.93
7.0.70.0330.04019.88
7.0.60.0170.04319.97
7.0.50.0330.04020.37
7.0.40.0030.03720.18
7.0.30.0030.05719.95
7.0.20.0030.07020.13
7.0.10.0000.04320.12
7.0.00.0100.04320.09
5.6.280.0000.07321.07
5.6.230.0230.02720.75
5.6.220.0130.03020.50
5.6.210.0100.03320.56
5.6.200.0070.04320.95
5.6.190.0070.04021.18
5.6.180.0070.03721.04
5.6.170.0000.04020.92
5.6.160.0030.07721.12
5.6.150.0100.07720.96
5.6.140.0200.06720.93
5.6.130.0100.07720.94
5.6.120.0200.04021.09
5.6.110.0030.09020.96
5.6.100.0030.09021.04
5.6.90.0130.08021.00
5.6.80.0130.07720.50
5.6.70.0030.08720.46
5.6.60.0100.07720.33
5.6.50.0100.04720.33
5.6.40.0100.08320.39
5.6.30.0030.08320.39
5.6.20.0070.05320.45
5.6.10.0070.06720.39
5.6.00.0100.07320.43
5.5.370.0070.04020.58
5.5.360.0030.04020.35
5.5.350.0000.04320.46
5.5.340.0070.03720.93
5.5.330.0100.04020.80
5.5.320.0070.04020.87
5.5.310.0030.07320.93
5.5.300.0070.04320.78
5.5.290.0100.05020.80
5.5.280.0070.08320.73
5.5.270.0070.08020.79
5.5.260.0070.07020.91
5.5.250.0100.08020.71
5.5.240.0170.07020.21
5.5.230.0000.05320.27
5.5.220.0100.07320.21
5.5.210.0100.08020.26
5.5.200.0070.08720.12
5.5.190.0130.07720.15
5.5.180.0100.07320.21
5.5.160.0130.07720.12
5.5.150.0100.07720.28
5.5.140.0100.07320.18
5.5.130.0100.07320.28
5.5.120.0070.05020.15
5.5.110.0030.08020.26
5.5.100.0070.07720.08
5.5.90.0030.08320.07
5.5.80.0070.04720.06
5.5.70.0100.05320.12
5.5.60.0130.07020.01
5.5.50.0130.07020.07
5.5.40.0200.06320.09
5.5.30.0070.08019.92
5.5.20.0030.04720.09
5.5.10.0100.07720.06
5.5.00.0170.06719.96
5.4.450.0030.08019.49
5.4.440.0070.07319.45
5.4.430.0070.08019.46
5.4.420.0130.07319.20
5.4.410.0070.07719.23
5.4.400.0070.08019.12
5.4.390.0030.08319.13
5.4.380.0130.04019.05
5.4.370.0030.08318.95
5.4.360.0130.06719.04
5.4.350.0100.07718.88
5.4.340.0070.08319.09
5.4.320.0070.04018.95
5.4.310.0130.07019.14
5.4.300.0130.07019.09
5.4.290.0100.08019.13
5.4.280.0100.04719.03
5.4.270.0030.07719.04
5.4.260.0030.07719.03
5.4.250.0200.06719.12
5.4.240.0130.06319.12
5.4.230.0030.04718.88
5.4.220.0130.07019.20
5.4.210.0100.07319.02
5.4.200.0000.08319.03
5.4.190.0070.07019.03
5.4.180.0000.06319.12
5.4.170.0130.06718.99
5.4.160.0070.05719.21
5.4.150.0070.07719.07
5.4.140.0000.05716.51
5.4.130.0070.06316.50
5.4.120.0070.06716.46
5.4.110.0130.06316.40
5.4.100.0000.05316.44
5.4.90.0070.07016.42
5.4.80.0030.07716.37
5.4.70.0100.06716.55
5.4.60.0070.07316.48
5.4.50.0030.07716.30
5.4.40.0070.04716.57
5.4.30.0100.07316.38
5.4.20.0030.05016.30
5.4.10.0070.07316.46
5.4.00.0030.07715.78
5.3.290.0130.06714.70
5.3.280.0100.07714.57
5.3.270.0070.08314.64
5.3.260.0070.06314.70
5.3.250.0030.05314.64
5.3.240.0030.04714.60
5.3.230.0130.06714.74
5.3.220.0030.04714.60
5.3.210.0070.07714.50
5.3.200.0100.06714.68
5.3.190.0200.06314.71
5.3.180.0070.06314.50
5.3.170.0000.08714.63
5.3.160.0070.07714.56
5.3.150.0070.06014.55
5.3.140.0100.06014.55
5.3.130.0130.06714.56
5.3.120.0130.07014.64
5.3.110.0170.06714.67
5.3.100.0100.06314.02
5.3.90.0170.06714.14
5.3.80.0030.07714.14
5.3.70.0130.06014.16
5.3.60.0070.07014.07
5.3.50.0070.07013.95
5.3.40.0070.03713.86
5.3.30.0070.06314.02
5.3.20.0100.05013.68
5.3.10.0130.04013.74
5.3.00.0130.07013.78
5.2.170.0030.05312.73
5.2.160.0070.03312.73
5.2.150.0030.04712.73
5.2.140.0070.06012.73
5.2.130.0000.05712.73
5.2.120.0100.02712.73
5.2.110.0100.06012.73
5.2.100.0070.06012.73
5.2.90.0100.06312.73
5.2.80.0070.05012.73
5.2.70.0070.06012.73
5.2.60.0130.05712.73
5.2.50.0000.06712.73
5.2.40.0000.06312.73
5.2.30.0030.06312.73
5.2.20.0070.04312.73
5.2.10.0030.06012.73
5.2.00.0030.05712.73
5.1.60.0070.05012.73
5.1.50.0000.03312.73
5.1.40.0030.05312.73
5.1.30.0100.05312.73
5.1.20.0070.05712.73
5.1.10.0070.05012.73
5.1.00.0030.05012.73
5.0.50.0030.04712.73
5.0.40.0000.03312.73
5.0.30.0100.05712.73
5.0.20.0030.04712.73
5.0.10.0030.04712.73
5.0.00.0000.06012.73
4.4.90.0070.03012.73
4.4.80.0030.02312.73
4.4.70.0000.04012.73
4.4.60.0000.03312.73
4.4.50.0030.03312.73
4.4.40.0000.04012.73
4.4.30.0000.03712.73
4.4.20.0070.02712.73
4.4.10.0070.02712.73
4.4.00.0030.05712.73
4.3.110.0000.03712.73
4.3.100.0000.03712.73
4.3.90.0000.02712.73
4.3.80.0070.05012.73
4.3.70.0000.03012.73
4.3.60.0070.02012.73
4.3.50.0000.03712.73
4.3.40.0000.04012.73
4.3.30.0070.03012.73
4.3.20.0000.03712.73
4.3.10.0000.03012.73
4.3.00.0000.02712.73

preferences:
47.66 ms | 400 KiB | 5 Q