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"); ?>

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.0100.01018.81
8.3.50.0130.00321.21
8.3.40.0090.00618.97
8.3.30.0130.00020.17
8.3.20.0000.00920.66
8.3.10.0040.00421.11
8.3.00.0070.00023.66
8.2.180.0000.01516.63
8.2.170.0110.00422.96
8.2.160.0070.01320.39
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0060.00326.16
8.2.120.0080.00021.13
8.2.110.0090.00020.42
8.2.100.0080.00417.84
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0040.00418.05
8.2.50.0040.00418.10
8.2.40.0000.00818.22
8.2.30.0040.00419.35
8.2.20.0000.00817.78
8.2.10.0040.00417.72
8.2.00.0000.00817.75
8.1.280.0100.01025.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00023.92
8.1.230.0070.00417.45
8.1.220.0060.00617.74
8.1.210.0090.00018.77
8.1.200.0030.00617.47
8.1.190.0040.00417.10
8.1.180.0000.00818.10
8.1.170.0000.00818.52
8.1.160.0040.00418.88
8.1.150.0070.00018.64
8.1.140.0060.00317.44
8.1.130.0030.00317.82
8.1.120.0000.00717.32
8.1.110.0000.00717.49
8.1.100.0050.00317.42
8.1.90.0000.00717.45
8.1.80.0000.00817.37
8.1.70.0030.00317.36
8.1.60.0040.00417.57
8.1.50.0070.00017.44
8.1.40.0000.00717.43
8.1.30.0000.00817.66
8.1.20.0030.00617.59
8.1.10.0040.00417.51
8.1.00.0000.00817.28
8.0.300.0070.00018.77
8.0.290.0050.00216.88
8.0.280.0000.00718.46
8.0.270.0030.00317.27
8.0.260.0030.00616.78
8.0.250.0050.00316.90
8.0.240.0050.00316.93
8.0.230.0030.00316.97
8.0.220.0000.00716.85
8.0.210.0030.00316.91
8.0.200.0030.00316.99
8.0.190.0050.00217.09
8.0.180.0070.00016.98
8.0.170.0040.00416.87
8.0.160.0000.00716.99
8.0.150.0070.00016.95
8.0.140.0090.00016.93
8.0.130.0030.00313.37
8.0.120.0000.00816.93
8.0.110.0040.00416.78
8.0.100.0000.00716.97
8.0.90.0040.00416.93
8.0.80.0090.01216.98
8.0.70.0080.00017.02
8.0.60.0080.00016.90
8.0.50.0000.00816.95
8.0.30.0110.00817.10
8.0.20.0070.01117.40
8.0.10.0040.00416.98
8.0.00.0110.01116.72
7.4.330.0000.00615.00
7.4.320.0000.00616.53
7.4.300.0000.00616.63
7.4.290.0000.00716.62
7.4.280.0000.00816.59
7.4.270.0000.00716.42
7.4.260.0000.00613.23
7.4.250.0040.00416.57
7.4.240.0040.00416.37
7.4.230.0000.00716.69
7.4.220.0090.00916.61
7.4.210.0070.00716.50
7.4.200.0040.00416.63
7.4.190.0030.00316.64
7.4.160.0160.00616.54
7.4.150.0090.00917.40
7.4.140.0140.00617.86
7.4.130.0080.00916.63
7.4.120.0060.01116.66
7.4.110.0070.01016.57
7.4.100.0100.00616.64
7.4.90.0060.01216.61
7.4.80.0070.01019.39
7.4.70.0110.01316.68
7.4.60.0080.00816.36
7.4.50.0000.00816.60
7.4.40.0130.00322.77
7.4.30.0100.00616.49
7.4.00.0040.01214.95
7.3.330.0050.00013.45
7.3.320.0000.00513.50
7.3.310.0030.00316.47
7.3.300.0020.00516.43
7.3.290.0030.01016.38
7.3.280.0060.01116.39
7.3.270.0160.00017.40
7.3.260.0150.00718.24
7.3.250.0090.00816.42
7.3.240.0070.01516.39
7.3.230.0090.00916.63
7.3.210.0040.01416.54
7.3.200.0100.01319.39
7.3.190.0030.01316.50
7.3.180.0090.00916.39
7.3.170.0030.01216.56
7.3.160.0130.00416.58
7.3.120.0000.01814.89
7.2.330.0130.00616.81
7.2.320.0100.00716.81
7.2.310.0120.00616.75
7.2.300.0070.01416.81
7.2.290.0120.00416.55
7.1.70.0090.00617.05
7.1.60.0100.01319.17
7.1.50.0130.01017.05
7.1.00.0030.03322.54
7.0.200.1230.01016.85
7.0.140.0100.06722.12
7.0.110.0570.05720.02
7.0.100.0270.07720.14
7.0.90.0470.08319.97
7.0.80.0900.07019.94
7.0.70.0370.07720.00
7.0.60.0500.08320.03
7.0.50.0470.07319.97
7.0.40.0130.08019.65
7.0.30.0070.08019.84
7.0.20.0030.08319.84
7.0.10.0100.07319.85
7.0.00.0070.08019.87
5.6.280.0070.06721.09
5.6.260.0170.06020.67
5.6.250.0100.05720.75
5.6.240.0070.07720.68
5.6.230.0070.08320.56
5.6.220.0100.07320.63
5.6.210.0070.05020.61
5.6.200.0100.07720.83
5.6.190.0030.08020.59
5.6.180.0070.06720.47
5.6.170.0070.08020.63
5.6.160.0100.07320.64
5.6.150.0070.04720.48
5.6.140.0100.08020.59
5.6.130.0170.07320.86
5.6.120.0070.09020.47
5.6.110.0100.07720.68
5.6.100.0070.08320.70
5.6.90.0130.07020.60
5.6.80.0000.08319.95
5.6.70.0030.08720.08
5.6.60.0070.07719.98
5.6.50.0100.04320.09
5.6.40.0100.06019.97
5.6.30.0030.08019.93
5.6.20.0030.08719.83
5.6.10.0100.04319.93
5.6.00.0000.05719.93
5.5.380.0070.08020.33
5.5.370.0130.07720.55
5.5.360.0100.08020.24
5.5.350.0100.07720.42
5.5.340.0130.06720.82
5.5.330.0030.08320.88
5.5.320.0100.07020.91
5.5.310.0170.07020.78
5.5.300.0200.07020.95
5.5.290.0100.08021.04
5.5.280.0030.08320.96
5.5.270.0030.07320.90
5.5.260.0200.07720.80
5.5.250.0070.08020.68
5.5.240.0030.08320.13
5.5.230.0030.08720.07
5.5.220.0070.07020.15
5.5.210.0130.07020.12
5.5.200.0000.08320.34
5.5.190.0170.07720.37
5.5.180.0200.05320.31
5.5.160.0100.07320.34
5.5.150.0070.06020.09
5.5.140.0130.06720.31
5.5.130.0030.06720.16
5.5.120.0130.06720.31
5.5.110.0200.06020.33
5.5.100.0030.05020.26
5.5.90.0070.06320.25
5.5.80.0200.07020.01
5.5.70.0030.08320.02
5.5.60.0170.03720.18
5.5.50.0130.07020.06
5.5.40.0100.07320.07
5.5.30.0000.08320.13
5.5.20.0100.07320.20
5.5.10.0070.08320.20
5.5.00.0070.06020.02
5.4.450.0100.07019.57
5.4.440.0030.07719.33
5.4.430.0000.08019.30
5.4.420.0070.07719.57
5.4.410.0100.06719.20
5.4.400.0100.07319.18
5.4.390.0200.06318.98
5.4.380.0070.06319.03
5.4.370.0070.07719.00
5.4.360.0100.06319.24
5.4.350.0030.08018.98
5.4.340.0070.04719.03
5.4.320.0130.05719.01
5.4.310.0100.07719.09
5.4.300.0100.04718.98
5.4.290.0000.08019.00
5.4.280.0130.04319.14
5.4.270.0070.06019.14
5.4.260.0100.04718.98
5.4.250.0030.08319.25
5.4.240.0070.07719.05
5.4.230.0000.08018.98
5.4.220.0070.07719.25
5.4.210.0030.08319.16
5.4.200.0170.03318.98
5.4.190.0000.08019.00
5.4.180.0100.07719.08
5.4.170.0100.06719.01
5.4.160.0100.07319.14
5.4.150.0130.07319.14
5.4.140.0170.06016.34
5.4.130.0100.06716.38
5.4.120.0100.06316.58
5.4.110.0100.07016.55
5.4.100.0030.04316.52
5.4.90.0130.06316.62
5.4.80.0100.06716.59
5.4.70.0130.03716.58
5.4.60.0100.07316.47
5.4.50.0030.07016.55
5.4.40.0100.06716.58
5.4.30.0030.07716.38
5.4.20.0100.07016.52
5.4.10.0030.08016.47
5.4.00.0030.07015.78
5.3.290.0070.04014.80
5.3.280.0030.08014.69
5.3.270.0100.07014.64
5.3.260.0070.07714.75
5.3.250.0030.07714.74
5.3.240.0070.08014.74
5.3.230.0000.08314.68
5.3.220.0030.05014.58
5.3.210.0070.07014.59
5.3.200.0100.07314.43
5.3.190.0030.05014.53
5.3.180.0030.06314.58
5.3.170.0030.07714.53
5.3.160.0130.05314.60
5.3.150.0130.07314.56
5.3.140.0130.07014.79
5.3.130.0100.07314.79
5.3.120.0100.07314.69
5.3.110.0030.07714.56
5.3.100.0130.05314.28
5.3.90.0130.07014.16
5.3.80.0070.05714.08
5.3.70.0030.08013.98
5.3.60.0070.07313.88
5.3.50.0100.04714.02
5.3.40.0070.06713.81
5.3.30.0070.06314.04
5.3.20.0100.07013.79
5.3.10.0170.05013.80
5.3.00.0030.07313.64
5.2.170.0030.06711.73
5.2.160.0100.06011.73
5.2.150.0070.05011.73
5.2.140.0070.06711.73
5.2.130.0070.05311.73
5.2.120.0070.05311.73
5.2.110.0030.06011.73
5.2.100.0030.06011.73
5.2.90.0070.06011.73
5.2.80.0030.05711.73
5.2.70.0000.06711.73
5.2.60.0070.06011.73
5.2.50.0030.07311.73
5.2.40.0000.04711.73
5.2.30.0030.02711.73
5.2.20.0030.05011.73
5.2.10.0100.04311.73
5.2.00.0070.06011.73
5.1.60.0100.05011.73
5.1.50.0070.05311.73
5.1.40.0100.03711.73
5.1.30.0100.02711.73
5.1.20.0000.05711.73
5.1.10.0030.06011.73
5.1.00.0030.05711.73
5.0.50.0070.04011.73
5.0.40.0030.04711.73
5.0.30.0000.06711.73
5.0.20.0000.03311.73
5.0.10.0000.04711.73
5.0.00.0100.06311.73
4.4.90.0000.02711.73
4.4.80.0030.01711.73
4.4.70.0000.02011.73
4.4.60.0000.02311.73
4.4.50.0100.02711.73
4.4.40.0030.04311.73
4.4.30.0030.03311.73
4.4.20.0030.03711.73
4.4.10.0000.03711.73
4.4.00.0070.04711.73
4.3.110.0070.03311.73
4.3.100.0030.03311.73
4.3.90.0000.02011.73
4.3.80.0070.03011.73
4.3.70.0070.03011.73
4.3.60.0030.03011.73
4.3.50.0030.03311.73
4.3.40.0070.04711.73
4.3.30.0000.03711.73
4.3.20.0000.04011.73
4.3.10.0070.02711.73
4.3.00.0100.01011.73

preferences:
35.07 ms | 401 KiB | 5 Q