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"),"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.0110.00416.63
8.3.50.0120.00722.00
8.3.40.0110.00718.76
8.3.30.0140.00521.09
8.3.20.0090.00521.93
8.3.10.0100.00323.25
8.3.00.0090.00521.17
8.2.180.0090.00618.54
8.2.170.0170.00322.96
8.2.160.0080.00821.71
8.2.150.0080.00523.57
8.2.140.0070.00723.81
8.2.130.0080.00624.56
8.2.120.0090.00522.54
8.2.110.0090.00521.15
8.2.100.0110.00520.47
8.2.90.0080.00621.15
8.2.80.0090.00620.29
8.2.70.0090.00620.29
8.2.60.0060.00720.36
8.2.50.0060.00820.29
8.2.40.0100.00521.52
8.2.30.0070.00820.52
8.2.20.0030.01020.40
8.2.10.0050.00920.56
8.2.00.0070.00720.38
8.1.280.0140.00425.92
8.1.270.0120.00322.58
8.1.260.0100.00324.66
8.1.250.0110.00325.53
8.1.240.0120.00222.58
8.1.230.0080.00722.83
8.1.220.0090.00720.37
8.1.210.0050.01120.97
8.1.200.0140.00220.24
8.1.190.0110.00320.09
8.1.180.0090.00720.53
8.1.170.0080.00720.77
8.1.160.0080.00822.44
8.1.150.0120.00520.76
8.1.140.0110.00620.21
8.1.130.0090.00420.36
8.1.120.0090.00620.15
8.1.110.0100.00820.15
8.1.100.0080.00820.21
8.1.90.0120.00420.22
8.1.80.0140.00320.20
8.1.70.0080.00620.20
8.1.60.0110.00620.26
8.1.50.0100.00620.20
8.1.40.0160.00220.27
8.1.30.0050.00820.30
8.1.20.0120.00320.34
8.1.10.0150.00420.20
8.1.00.0100.00520.13
8.0.300.0050.00921.56
8.0.290.0080.00719.86
8.0.280.0120.00720.71
8.0.270.0030.01020.12
8.0.260.0110.00620.08
8.0.250.0100.00419.98
8.0.240.0090.00919.97
8.0.230.0070.00819.93
8.0.220.0090.00619.92
8.0.210.0110.00519.96
8.0.200.0110.00519.92
8.0.190.0130.00419.95
8.0.180.0120.00419.92
8.0.170.0120.00619.96
8.0.160.0030.01019.89
8.0.150.0110.00519.89
8.0.140.0150.00219.88
8.0.130.0070.00718.17
8.0.120.0070.00819.90
8.0.110.0090.00619.96
8.0.100.0120.00119.89
8.0.90.0090.00619.90
8.0.80.0100.01019.92
8.0.70.0050.00819.99
8.0.60.0110.00519.98
8.0.50.0050.00919.97
8.0.30.0100.01118.94
8.0.20.0090.01019.26
8.0.10.0080.00720.05
8.0.00.0120.00818.89
7.4.330.0090.00219.02
7.4.320.0130.00419.78
7.4.300.0120.00519.73
7.4.290.0120.00719.70
7.4.280.0140.00319.74
7.4.270.0070.00819.74
7.4.260.0090.00919.78
7.4.250.0150.00219.77
7.4.240.0080.00318.69
7.4.230.0100.00819.82
7.4.220.0170.01119.73
7.4.210.0110.00518.19
7.4.200.0090.00919.84
7.4.190.0150.00019.72
7.4.180.0240.00322.96
7.4.160.0120.01019.68
7.4.150.0100.01020.18
7.4.140.0120.01019.56
7.4.130.0100.01318.70
7.4.120.0150.00518.63
7.4.110.0190.00719.75
7.4.100.0170.00519.79
7.4.90.0160.00519.78
7.4.80.0190.00721.18
7.4.70.0210.00519.67
7.4.60.0080.01218.12
7.4.50.0140.00718.35
7.4.40.0070.01218.46
7.4.30.0090.01118.63
7.4.20.0200.00318.52
7.4.10.0110.00918.54
7.4.00.0050.01517.76
7.3.330.0110.00718.20
7.3.320.0130.00418.19
7.3.310.0150.00119.62
7.3.300.0080.00719.70
7.3.290.0150.00619.71
7.3.280.0130.00618.04
7.3.270.0170.00420.18
7.3.260.0140.01019.85
7.3.250.0120.00818.71
7.3.240.0130.00919.78
7.3.230.0140.01019.68
7.3.220.0220.00622.96
7.3.210.0170.00619.82
7.3.200.0120.01021.18
7.3.190.0190.00719.78
7.3.180.0160.00418.47
7.3.170.0120.00918.45
7.3.160.0120.00818.56
7.3.150.0160.00518.69
7.3.140.0190.00418.51
7.3.130.0160.00618.58
7.3.120.0110.00717.65
7.3.110.0170.00118.56
7.3.100.0150.00718.53
7.3.90.0130.00818.63
7.3.80.0150.00718.56
7.3.70.0090.01218.51
7.3.60.0070.01318.56
7.3.50.0130.00718.61
7.3.40.0120.00718.54
7.3.30.0090.01018.50
7.3.20.0130.00718.55
7.3.10.0160.00417.97
7.3.00.0120.00718.01
7.2.340.0140.01422.96
7.2.330.0190.00519.74
7.2.320.0170.00519.85
7.2.310.0130.01018.72
7.2.300.0110.01018.59
7.2.290.0110.01018.66
7.2.280.0150.00718.80
7.2.270.0110.00918.60
7.2.260.0110.00918.62
7.2.250.0100.01018.77
7.2.240.0110.00918.72
7.2.230.0110.01018.58
7.2.220.0130.00718.74
7.2.210.0120.00718.72
7.2.200.0070.01418.74
7.2.190.0120.00818.62
7.2.180.0160.00618.69
7.2.170.0100.00818.68
7.2.160.0110.00818.66
7.2.150.0090.01118.82
7.2.140.0080.01218.77
7.2.130.0130.00818.26
7.2.120.0110.01018.26
7.2.110.0140.00618.18
7.2.100.0090.00918.27
7.2.90.0110.00918.29
7.2.80.0100.01418.28
7.2.70.0130.01018.23
7.2.60.0100.00818.02
7.2.50.0220.00818.29
7.2.40.0130.00918.33
7.2.30.0130.00618.30
7.2.20.0140.00918.14
7.2.10.0110.01118.12
7.2.00.0110.01018.16
7.1.330.0210.00618.02
7.1.320.0370.00518.05
7.1.310.0180.01118.15
7.1.300.0240.00518.06
7.1.290.0240.00718.14
7.1.280.0190.00818.02
7.1.270.0210.00618.07
7.1.260.0260.00718.01
7.1.250.0130.00917.52
7.1.240.0190.00818.06
7.1.230.0200.00717.97
7.1.220.0210.00917.95
7.1.210.0290.00818.03
7.1.200.0190.00917.55
7.1.190.0130.01218.00
7.1.180.0240.00617.98
7.1.170.0150.01218.01
7.1.160.0190.00718.04
7.1.150.0190.00818.06
7.1.140.0220.00718.03
7.1.130.0230.01218.03
7.1.120.0180.01018.00
7.1.110.0190.00718.12
7.1.100.0170.00918.08
7.1.90.0260.01118.10
7.1.80.0210.00818.11
7.1.70.0110.01217.82
7.1.60.0110.01518.42
7.1.50.0170.00717.74
7.1.40.0240.00618.06
7.1.30.0280.00618.05
7.1.20.0230.00818.12
7.1.10.0180.00717.99
7.1.00.0190.02219.13
7.0.330.0190.01017.90
7.0.320.0190.00917.83
7.0.310.0150.01317.79
7.0.300.0210.00917.87
7.0.290.0230.00717.86
7.0.280.0230.00717.94
7.0.270.0200.00717.91
7.0.260.0240.00717.87
7.0.250.0230.00317.81
7.0.240.0180.00917.88
7.0.230.0240.00417.84
7.0.220.0180.00817.87
7.0.210.0200.00617.74
7.0.200.0140.01217.04
7.0.190.0240.00617.83
7.0.180.0240.00717.90
7.0.170.0220.00917.91
7.0.160.0220.00717.89
7.0.150.0210.01017.86
7.0.140.0190.02918.91
7.0.130.0210.00917.88
7.0.120.0240.01317.85
7.0.110.0160.00717.83
7.0.100.0160.01017.71
7.0.90.0110.01217.81
7.0.80.0170.00617.83
7.0.70.0130.01217.83
7.0.60.0090.02118.37
7.0.50.0110.02217.76
7.0.40.0160.01718.37
7.0.30.0170.01618.44
7.0.20.0190.01818.39
7.0.10.0160.02118.39
7.0.00.0160.02618.40
5.6.400.0220.00518.36
5.6.390.0200.00818.42
5.6.380.0190.01218.42
5.6.370.0200.00818.15
5.6.360.0210.00618.46
5.6.350.0230.00718.38
5.6.340.0180.01218.28
5.6.330.0170.01218.46
5.6.320.0170.01118.38
5.6.310.0180.01118.29
5.6.300.0200.00818.18
5.6.290.0190.00718.36
5.6.280.0160.02518.97
5.6.270.0170.01118.33
5.6.260.0190.00718.31
5.6.250.0190.01018.29
5.6.240.0190.00818.26
5.6.230.0160.00818.33
5.6.220.0190.00718.27
5.6.210.0170.02618.77
5.6.200.0200.02518.24
5.6.190.0150.03018.81
5.6.180.0210.02618.91
5.6.170.0180.03018.85
5.6.160.0140.02818.84
5.6.150.0170.02118.24
5.6.140.0160.02418.28
5.6.130.0180.02318.29
5.6.120.0140.01918.96
5.6.110.0160.02618.92
5.6.100.0160.02718.94
5.6.90.0150.02618.89
5.6.80.0110.02718.77
5.6.70.1260.01818.74
5.6.60.0160.01018.22
5.6.50.0160.01118.33
5.6.40.0240.00418.23
5.6.30.0150.01218.17
5.6.20.0160.01118.23
5.6.10.0180.01018.17
5.6.00.0130.01318.24
5.5.380.0200.00918.26
5.5.370.0210.01018.20
5.5.360.0260.00518.32
5.5.350.0150.01918.79
5.5.340.0170.01418.27
5.5.330.0190.02618.71
5.5.320.0290.02318.81
5.5.310.0210.01718.83
5.5.300.0180.02918.21
5.5.290.0170.02818.19
5.5.280.0150.02818.92
5.5.270.0200.02818.85
5.5.260.0180.02318.91
5.5.250.0190.02218.77
5.5.240.0210.02218.78
5.5.230.0210.00718.28
5.5.220.0190.01018.25
5.5.210.0180.01118.29
5.5.200.0170.01118.16
5.5.190.0210.01018.13
5.5.180.0220.01218.31
5.5.170.0220.01018.19
5.5.160.0200.01118.31
5.5.150.0200.01118.29
5.5.140.0180.01418.27
5.5.130.0210.00718.27
5.5.120.0220.00918.11
5.5.110.0240.00718.27
5.5.100.0200.01118.14
5.5.90.0190.01018.27
5.5.80.0220.00918.24
5.5.70.0200.01018.22
5.5.60.0180.01018.29
5.5.50.0150.01218.27
5.5.40.0150.01518.18
5.5.30.0200.01018.24
5.5.20.0190.01218.20
5.5.10.0190.00918.04
5.5.00.0180.01118.17
5.4.450.0170.02117.04
5.4.440.0190.01517.05
5.4.430.0190.01717.01
5.4.420.0200.01717.03
5.4.410.0190.01816.99
5.4.400.0190.02416.88
5.4.390.0190.01416.92
5.4.380.0190.01316.92
5.4.370.0150.02316.82
5.4.360.0140.02316.90
5.4.350.0180.01616.96
5.4.340.0210.01716.87
5.4.330.0190.00616.16
5.4.320.0200.02216.86
5.4.310.0190.01716.92
5.4.300.0220.01416.77
5.4.290.0180.01816.79
5.4.280.0190.01816.89
5.4.270.0190.02316.76
5.4.260.0190.02416.95
5.4.250.0190.02116.88
5.4.240.0200.02116.77
5.4.230.0200.01916.77
5.4.220.0200.02716.86
5.4.210.0170.02416.89
5.4.200.0170.02316.87
5.4.190.0200.01716.87
5.4.180.0190.02016.85
5.4.170.0180.02216.92
5.4.160.0180.01816.85
5.4.150.0210.01516.84
5.4.140.0210.02116.34
5.4.130.0230.01816.23
5.4.120.0210.02016.32
5.4.110.0170.02416.26
5.4.100.0180.01816.19
5.4.90.0170.01816.33
5.4.80.0160.02416.18
5.4.70.0150.01816.27
5.4.60.0150.02416.21
5.4.50.0150.02316.21
5.4.40.0190.01516.22
5.4.30.0130.01816.18
5.4.20.0190.02016.27
5.4.10.0210.01216.17
5.4.00.0140.02516.09
5.3.290.0130.02416.05
5.3.280.0160.01415.98
5.3.270.0180.02316.00
5.3.260.0170.02315.97
5.3.250.0170.02115.97
5.3.240.0130.02615.98
5.3.230.0160.01815.90
5.3.220.0120.02215.94
5.3.210.0150.02215.90
5.3.200.0090.02715.98
5.3.190.0180.02216.02
5.3.180.0190.02116.03
5.3.170.0180.02016.03
5.3.160.0160.01616.02
5.3.150.0170.01315.95
5.3.140.0140.01615.95
5.3.130.0160.01815.95
5.3.120.0160.02315.96
5.3.110.0140.02316.00
5.3.100.0180.02215.83
5.3.90.0140.01915.82
5.3.80.0110.02115.85
5.3.70.0130.01815.77
5.3.60.0160.02315.79
5.3.50.0160.01715.79
5.3.40.0160.02015.73
5.3.30.0120.02315.79
5.3.20.0160.02015.68
5.3.10.0180.01715.65
5.3.00.0140.02315.55

preferences:
45.38 ms | 401 KiB | 5 Q