3v4l.org

run code in 300+ PHP versions simultaneously
<?php class xxtea { public function encrypt($key, $salt = null) { if (is_null($salt)) { $strSalt = $this->salt; } else { $strSalt = $salt; } return str_replace(array('+', '/', '='), array('-', '_', '.'), base64_encode($this->xxteaEncrypt($key, $strSalt))); } public function decrypt($value, $salt = null) { if (is_null($salt)) { $strSalt = $this->salt; } else { $strSalt = $salt; } $strValue = str_replace(array('-', '_', '.'), array('+', '/', '='), $value); return $this->xxteaDecrypt(base64_decode($strValue), $strSalt); } private function long2str($v, $w) { $len = count($v); $n = ($len - 1) << 2; if ($w) { $m = $v[$len - 1]; if (($m < $n - 3) || ($m > $n)) return false; $n = $m; } $s = array(); for ($i = 0; $i < $len; $i++) { $s[$i] = pack("V", $v[$i]); } if ($w) { return substr(join('', $s), 0, $n); } else { return join('', $s); } } private function str2long($s, $w) { $v = unpack("V*", $s . str_repeat("\0", (4 - strlen($s) % 4) & 3)); $v = array_values($v); if ($w) { $v[count($v)] = strlen($s); } return $v; } private function int32($n) { while ($n >= 2147483648) $n -= 4294967296; while ($n <= -2147483649) $n += 4294967296; return (int) $n; } private function xxteaEncrypt($str, $key) { if ($str == "") { return ""; } $v = $this->str2long($str, true); $k = $this->str2long($key, false); if (count($k) < 4) { for ($i = count($k); $i < 4; $i++) { $k[$i] = 0; } } $n = count($v) - 1; $z = $v[$n]; $y = $v[0]; $delta = 0x9E3779B9; $q = floor(6 + 52 / ($n + 1)); $sum = 0; while (0 < $q--) { $sum = $this->int32($sum + $delta); $e = $sum >> 2 & 3; for ($p = 0; $p < $n; $p++) { $y = $v[$p + 1]; $mx = $this->int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ $this->int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z)); $z = $v[$p] = $this->int32($v[$p] + $mx); } $y = $v[0]; $mx = $this->int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ $this->int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z)); $z = $v[$n] = $this->int32($v[$n] + $mx); } return $this->long2str($v, false); } private function xxteaDecrypt($str, $key) { if ($str == "") { return ""; } $v = $this->str2long($str, false); $k = $this->str2long($key, false); if (count($k) < 4) { for ($i = count($k); $i < 4; $i++) { $k[$i] = 0; } } $n = count($v) - 1; $z = $v[$n]; $y = $v[0]; $delta = 0x9E3779B9; $q = floor(6 + 52 / ($n + 1)); $sum = $this->int32($q * $delta); while ($sum != 0) { $e = $sum >> 2 & 3; for ($p = $n; $p > 0; $p--) { $z = $v[$p - 1]; $mx = $this->int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ $this->int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z)); $y = $v[$p] = $this->int32($v[$p] - $mx); } $z = $v[$n]; $mx = $this->int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ $this->int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z)); $y = $v[0] = $this->int32($v[0] - $mx); $sum = $this->int32($sum - $delta); } return $this->long2str($v, true); } } $xxtea = new xxtea(); $vid = $xxtea->decrypt('xSz5rd55YacQwj-sjO8VbQ..', '!@#^~ku6&%(com)T'); var_dump($vid);

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.00418.30
8.3.50.0130.01121.09
8.3.40.0110.00718.88
8.3.30.0120.00618.72
8.3.20.0100.01018.90
8.3.10.0040.00421.21
8.3.00.0030.00721.85
8.2.180.0120.00916.50
8.2.170.0160.00622.96
8.2.160.0090.01220.65
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00417.75
8.2.110.0150.00620.43
8.2.100.0090.00318.03
8.2.90.0040.00419.23
8.2.80.0000.00719.34
8.2.70.0030.00517.63
8.2.60.0030.00618.04
8.2.50.0110.00018.07
8.2.40.0030.00618.16
8.2.30.0050.00219.58
8.2.20.0000.00717.67
8.2.10.0040.00417.82
8.2.00.0030.00717.80
8.1.280.0070.00725.92
8.1.270.0060.00322.19
8.1.260.0040.00426.35
8.1.250.0070.00428.09
8.1.240.0030.00622.65
8.1.230.0080.00421.18
8.1.220.0090.00018.77
8.1.210.0080.00019.01
8.1.200.0060.00317.48
8.1.190.0000.00917.65
8.1.180.0000.00918.10
8.1.170.0080.00018.59
8.1.160.0070.00018.96
8.1.150.0020.00518.71
8.1.140.0040.00417.53
8.1.130.0000.00717.83
8.1.120.0050.00217.51
8.1.110.0060.00317.52
8.1.100.0000.00817.49
8.1.90.0000.00717.44
8.1.80.0040.00417.55
8.1.70.0030.00317.36
8.1.60.0040.00417.67
8.1.50.0050.00317.50
8.1.40.0000.00917.48
8.1.30.0030.00517.74
8.1.20.0060.00317.78
8.1.10.0000.00817.69
8.1.00.0000.00817.57
8.0.300.0000.00820.15
8.0.290.0040.00417.16
8.0.280.0000.00718.43
8.0.270.0030.00517.34
8.0.260.0030.00316.80
8.0.250.0000.00717.05
8.0.240.0000.00817.10
8.0.230.0000.00717.03
8.0.220.0070.00017.07
8.0.210.0070.00017.03
8.0.200.0000.00716.93
8.0.190.0050.00316.93
8.0.180.0000.00816.97
8.0.170.0040.00417.02
8.0.160.0000.00716.95
8.0.150.0040.00416.91
8.0.140.0000.00716.91
8.0.130.0030.00313.42
8.0.120.0040.00416.91
8.0.110.0000.00816.95
8.0.100.0040.00416.96
8.0.90.0090.00016.99
8.0.80.0060.01516.97
8.0.70.0050.00216.97
8.0.60.0040.00417.09
8.0.50.0080.00016.80
8.0.30.0140.00617.26
8.0.20.0120.00817.40
8.0.10.0000.00817.13
8.0.00.0090.01016.61
7.4.330.0000.00616.67
7.4.320.0000.00716.51
7.4.300.0030.00316.67
7.4.290.0040.00416.67
7.4.280.0040.00416.68
7.4.270.0000.00716.73
7.4.260.0000.00513.33
7.4.250.0050.00216.64
7.4.240.0030.00316.72
7.4.230.0000.00716.58
7.4.220.0150.00316.47
7.4.210.0080.00916.66
7.4.200.0000.00716.77
7.4.190.0040.00416.64
7.4.160.0070.01016.49
7.4.150.0110.00717.40
7.4.140.0120.01017.86
7.4.130.0130.00616.52
7.4.120.0050.01316.66
7.4.110.0170.00016.51
7.4.100.0070.01716.71
7.4.90.0060.01216.55
7.4.80.0110.00719.39
7.4.70.0080.01116.59
7.4.60.0100.01016.64
7.4.50.0040.00416.67
7.4.40.0080.00422.77
7.4.30.0090.01016.55
7.4.10.0070.01114.75
7.4.00.0060.01215.05
7.3.330.0000.00513.41
7.3.320.0040.00413.38
7.3.310.0050.00216.45
7.3.300.0000.00816.39
7.3.290.0000.01516.35
7.3.280.0090.01016.42
7.3.270.0060.01217.40
7.3.260.0100.01318.24
7.3.250.0100.00916.50
7.3.240.0090.01216.43
7.3.230.0060.01016.57
7.3.210.0090.00916.73
7.3.200.0150.00419.39
7.3.190.0090.00916.70
7.3.180.0100.01016.57
7.3.170.0080.00816.62
7.3.160.0070.01016.66
7.3.130.0100.01014.81
7.3.120.0080.00715.01
7.3.110.0080.01114.74
7.3.100.0050.01214.89
7.3.90.0080.00714.88
7.3.80.0070.00614.98
7.3.70.0020.01114.92
7.3.60.0050.01115.00
7.3.50.0040.00615.04
7.3.40.0070.00814.93
7.3.30.0080.00514.87
7.3.20.0090.00416.78
7.3.10.0090.00616.54
7.3.00.0050.00816.69
7.2.330.0060.01216.87
7.2.320.0110.00916.90
7.2.310.0080.00816.68
7.2.300.0030.01316.63
7.2.290.0040.01216.68
7.2.260.0060.01315.09
7.2.250.0070.01215.22
7.2.240.0100.00815.07
7.2.230.0050.01015.29
7.2.220.0050.01215.06
7.2.210.0060.00515.11
7.2.200.0060.00915.06
7.2.190.0050.00815.16
7.2.180.0060.00515.09
7.2.170.0120.00315.20
7.2.160.0040.01115.20
7.2.150.0050.00716.91
7.2.140.0030.01416.98
7.2.130.0060.01016.94
7.2.120.0060.00816.92
7.2.110.0050.01116.90
7.2.100.0060.00816.96
7.2.90.0040.01116.90
7.2.80.0040.01016.97
7.2.70.0050.00917.01
7.2.60.0040.01216.75
7.2.50.0120.00617.02
7.2.40.0070.00716.93
7.2.30.0070.00817.08
7.2.20.0060.00916.96
7.2.10.0090.00616.96
7.2.00.0090.00517.60
7.1.330.0110.00515.72
7.1.320.0050.01115.67
7.1.310.0020.01015.96
7.1.300.0040.00915.87
7.1.290.0070.00515.86
7.1.280.0050.01015.88
7.1.270.0060.00515.82
7.1.260.0030.01315.87
7.1.250.0090.00715.74
7.1.240.0030.01015.87
7.1.230.0100.00315.94
7.1.220.0080.00515.79
7.1.210.0050.01015.81
7.1.200.0070.00715.82
7.1.190.0070.00515.75
7.1.180.0050.00915.89
7.1.170.0030.00815.81
7.1.160.0050.01115.82
7.1.150.0080.00615.86
7.1.140.0050.00615.79
7.1.130.0050.00715.79
7.1.120.0030.01015.81
7.1.110.0010.00915.83
7.1.100.0040.00916.56
7.1.90.0080.00315.90
7.1.80.0040.00915.77
7.1.70.0040.00816.34
7.1.60.0580.00515.78
7.1.50.0060.01016.14
7.1.40.0050.00815.81
7.1.30.0080.00615.94
7.1.20.0060.00715.66
7.1.10.0050.00715.92
7.1.00.0040.03018.05
7.0.330.0060.00615.53
7.0.320.0070.00715.38
7.0.310.0020.01315.54
7.0.300.0060.00715.47
7.0.290.0070.00915.62
7.0.280.0060.00615.50
7.0.270.0050.00815.41
7.0.260.0050.00715.52
7.0.250.0050.00715.42
7.0.240.0020.01415.46
7.0.230.0070.00915.42
7.0.220.0050.00815.21
7.0.210.0020.01015.39
7.0.200.0040.01315.93
7.0.190.0070.00715.41
7.0.180.0100.00215.39
7.0.170.0020.01215.37
7.0.160.0020.01215.40
7.0.150.0050.00815.45
7.0.140.0080.02817.47
7.0.130.0040.01115.47
7.0.120.0090.00315.57
7.0.110.0020.01215.52
7.0.100.0040.03417.01
7.0.90.0080.01917.03
7.0.80.0030.03617.01
7.0.70.0090.02717.16
7.0.60.0080.02917.11
7.0.50.0050.03317.07
7.0.40.0070.03415.72
7.0.30.0070.02015.68
7.0.20.0080.01915.73
7.0.10.0020.02415.60
7.0.00.0030.02415.77
5.6.400.0060.00814.63
5.6.390.0020.00714.63
5.6.380.0040.01114.50
5.6.370.0110.00314.41
5.6.360.0050.00814.78
5.6.350.0000.01214.66
5.6.340.0090.00514.67
5.6.330.0040.01014.52
5.6.320.0070.00614.62
5.6.310.0110.00314.73
5.6.300.0080.00514.78
5.6.290.0060.00614.31
5.6.280.0060.03016.69
5.6.270.0040.01014.82
5.6.260.0040.00714.52
5.6.250.0040.03516.79
5.6.240.0090.01616.53
5.6.230.0070.03016.69
5.6.220.0030.03016.61
5.6.210.0070.02816.38
5.6.200.0060.03316.84
5.6.190.0070.03616.59
5.6.180.0080.02716.70
5.6.170.0050.02316.67
5.6.160.0030.02316.62
5.6.150.0050.03116.93
5.6.140.0060.01716.77
5.6.130.0030.02616.65
5.6.120.0090.02016.68
5.6.110.0030.03616.72
5.6.100.0080.03116.71
5.6.90.0050.02016.67
5.6.80.0080.02016.67
5.6.70.0060.01816.42
5.6.60.0060.03116.45
5.6.50.0070.01916.53
5.6.40.0050.03116.47
5.6.30.0050.02416.38
5.6.20.0020.03116.33
5.6.10.0070.02316.43
5.6.00.0060.01716.45
5.5.380.0060.03116.49
5.5.370.0070.02816.43
5.5.360.0060.03016.56
5.5.350.0080.03316.26
5.5.340.0090.02716.62
5.5.330.0080.03316.60
5.5.320.0060.02316.64
5.5.310.0060.01916.72
5.5.300.0060.02716.46
5.5.290.0090.01716.60
5.5.280.0060.02216.55
5.5.270.0070.01716.64
5.5.260.0030.03316.64
5.5.250.0060.02716.40
5.5.240.0060.02116.38
5.5.230.0060.01916.44
5.5.220.0030.02616.53
5.5.210.0080.01716.46
5.5.200.0060.02716.28
5.5.190.0070.01716.24
5.5.180.0080.01616.29
5.5.170.0020.00914.44
5.5.160.0000.02416.32
5.5.150.0040.01916.37
5.5.140.0060.01516.35
5.5.130.0080.02616.46
5.5.120.0030.03216.42
5.5.110.0070.02416.42
5.5.100.0050.01616.38
5.5.90.0010.02416.15
5.5.80.0040.01816.23
5.5.70.0050.03116.39
5.5.60.0070.03316.17
5.5.50.0070.02916.26
5.5.40.0070.02916.33
5.5.30.0050.02916.10
5.5.20.0090.02916.32
5.5.10.0080.03016.33
5.5.00.0060.03116.23
5.4.450.0050.02314.47
5.4.440.0040.02414.57
5.4.430.0020.01914.56
5.4.420.0030.03314.56
5.4.410.0060.01714.53
5.4.400.0080.01414.48
5.4.390.0030.02814.36
5.4.380.0040.01814.48
5.4.370.0020.01814.39
5.4.360.0060.02014.44
5.4.350.0020.01714.42
5.4.340.0080.01214.37
5.4.330.0060.00212.11
5.4.320.0050.02014.45
5.4.310.0040.01714.48
5.4.300.0040.01614.46
5.4.290.0030.01514.48
5.4.280.0040.02314.36
5.4.270.0060.01314.45
5.4.260.0040.02114.43
5.4.250.0020.02114.48
5.4.240.0030.02314.44
5.4.230.0050.02214.36
5.4.220.0050.02114.46
5.4.210.0050.02714.42
5.4.200.0070.02014.41
5.4.190.0050.03014.42
5.4.180.0050.03314.46
5.4.170.0020.03214.44
5.4.160.0080.02514.40
5.4.150.0040.03214.41
5.4.140.0040.03013.49
5.4.130.0100.02413.56
5.4.120.0030.02113.56
5.4.110.0070.02513.57
5.4.100.0030.03113.54
5.4.90.0090.02813.58
5.4.80.0100.02413.55
5.4.70.0040.02513.56
5.4.60.0050.02013.57
5.4.50.0060.03013.56
5.4.40.0050.02813.53
5.4.30.0080.01713.50
5.4.20.0020.03013.58
5.4.10.0020.01713.58
5.4.00.0030.02813.35
5.3.290.0040.02212.96
5.3.280.0060.02713.00
5.3.270.0020.02912.98
5.3.260.0030.03112.98
5.3.250.0030.03112.98
5.3.240.0080.02312.95
5.3.230.0040.02912.98
5.3.220.0050.03112.99
5.3.210.0090.02712.95
5.3.200.0080.02712.93
5.3.190.0040.02812.96
5.3.180.0040.03312.92
5.3.170.0020.03312.99
5.3.160.0030.03212.94
5.3.150.0000.02912.95
5.3.140.0050.02912.98
5.3.130.0040.03112.94
5.3.120.0040.02612.93
5.3.110.0050.02012.96
5.3.100.0050.02712.81
5.3.90.0040.02812.78
5.3.80.0060.03012.78
5.3.70.0050.02212.78
5.3.60.0090.01912.80
5.3.50.0030.02912.78
5.3.40.0050.03012.78
5.3.30.0040.02212.78
5.3.20.0050.02412.78
5.3.10.0060.02512.78
5.3.00.0070.02712.78

preferences:
40.76 ms | 401 KiB | 5 Q