3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * MCrypt Library to enable encryption and decryption using MCrypt. * NOTE: this is an adjusted version of the below source. * SOURCE: https://raw.githubusercontent.com/serpro/Android-PHP-Encrypt-Decrypt/master/PHP/MCrypt.php */ class Mcrypt { /** * IV parameter */ private $iv = 'hoewhowhahwoahoe'; function __construct() { // empty } /** * @param string $str * @param bool $isBinary whether to encrypt as binary or not. Default is: false * @return string Encrypted data */ public function encrypt($str, $key, $isBinary = FALSE) { // variables $str = $isBinary ? $str : utf8_decode($str); $td = mcrypt_module_open('rijndael-128', ' ', 'cbc', $this->iv); // guard: check if the str is valid if (empty($str)) { return $str; } mcrypt_generic_init($td, $key, $this->iv); $encrypted = mcrypt_generic($td, $str); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $isBinary ? $encrypted : base64_encode(bin2hex($encrypted)); } /** * @param string $code * @param bool $isBinary whether to decrypt as binary or not. Default is: false * @return string Decrypted data */ public function decrypt($code, $key, $isBinary = FALSE) { // variables $code = $isBinary ? $code : $this->hex2bin(base64_decode($code)); $td = mcrypt_module_open('rijndael-128', ' ', 'cbc', $this->iv); // guard: check if the code is valid if (empty($code)) { return $code; } mcrypt_generic_init($td, $key, $this->iv); $decrypted = mdecrypt_generic($td, $code); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $isBinary ? trim($decrypted) : utf8_encode(trim($decrypted)); } protected function hex2bin($hexdata) { $bindata = ''; for ($i = 0; $i < strlen($hexdata); $i += 2) { $bindata .= chr(hexdec(substr($hexdata, $i, 2))); } return $bindata; } } $mcrypt = new Mcrypt(); $key = "8f1ec9b37ccd2e88aa4279999818d28d"; $string = "OGZkM2M2NGI4MWRlMzg1MzlmZDRiN2ZjODA1NTM1MDA="; echo($mcrypt->decrypt($string, $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.5.10.0080.00920.14
8.5.00.0060.00820.45
8.4.150.0030.00014.05
8.4.140.0150.00717.85
8.4.130.0150.00618.00
8.4.120.0150.00520.62
8.4.110.0050.00622.60
8.4.100.0170.00417.85
8.4.90.0080.00320.64
8.4.80.0140.00418.03
8.4.70.0060.00218.05
8.4.60.0110.00920.43
8.4.50.0130.00918.73
8.4.40.0060.00321.44
8.4.30.0140.00317.90
8.4.20.0110.01117.71
8.4.10.0070.01319.68
8.3.280.0080.01118.57
8.3.270.0110.00816.53
8.3.260.0140.00816.54
8.3.250.0060.00218.75
8.3.240.0060.00916.80
8.3.230.0110.00816.67
8.3.220.0130.00717.36
8.3.210.0080.00716.61
8.3.200.0020.00716.87
8.3.190.0110.00816.86
8.3.180.0110.00917.17
8.3.170.0120.00619.04
8.3.160.0090.00917.30
8.3.150.0160.00317.34
8.3.140.0120.00316.72
8.3.130.0040.00418.52
8.3.120.0040.01220.52
8.3.110.0060.00320.94
8.3.100.0000.00816.73
8.3.90.0050.00326.77
8.3.80.0060.00316.74
8.3.70.0110.01116.75
8.3.60.0090.00616.75
8.3.50.0110.01121.97
8.3.40.0070.00718.82
8.3.30.0130.00618.96
8.3.20.0040.00420.38
8.3.10.0050.00321.85
8.3.00.0000.00822.38
8.2.290.0100.01020.53
8.2.280.0090.01118.31
8.2.270.0070.01116.96
8.2.260.0090.00917.01
8.2.250.0000.01016.92
8.2.240.0100.00717.06
8.2.230.0060.00322.58
8.2.220.0030.00624.06
8.2.210.0090.00926.77
8.2.200.0030.00718.29
8.2.190.0060.01216.88
8.2.180.0150.00425.92
8.2.170.0060.01018.96
8.2.160.0140.00022.96
8.2.150.0080.00024.18
8.2.140.0140.00424.66
8.2.130.0020.00522.25
8.2.120.0040.00426.35
8.2.110.0100.00520.82
8.2.100.0110.00619.35
8.2.90.0130.00718.34
8.2.80.0100.00518.25
8.2.70.0150.00718.14
8.2.60.0170.00318.16
8.2.50.0080.01419.07
8.2.40.0090.00718.62
8.2.30.0060.01018.50
8.2.20.0060.00618.54
8.2.10.0100.00618.55
8.2.00.0110.00817.97
8.1.330.0040.00523.79
8.1.320.0100.00816.36
8.1.310.0040.00418.67
8.1.300.0060.00318.59
8.1.290.0090.00030.84
8.1.280.0040.01125.92
8.1.270.0030.00623.99
8.1.260.0040.00428.09
8.1.250.0070.00028.09
8.1.240.0130.00821.22
8.1.230.0080.00520.67
8.1.220.0050.00618.08
8.1.210.0110.00020.24
8.1.200.0090.00717.80
8.1.190.0140.00517.84
8.1.180.0170.00418.23
8.1.170.0090.01017.88
8.1.160.0140.00618.27
8.1.150.0120.00718.79
8.1.140.0120.00718.16
8.1.130.0100.00817.69
8.1.120.0120.00617.65
8.1.110.0080.00817.61
8.1.100.0120.00517.56
8.1.90.0120.00417.60
8.1.80.0110.00617.58
8.1.70.0130.00617.56
8.1.60.0140.00617.74
8.1.50.0120.00517.67
8.1.40.0130.00517.66
8.1.30.0120.00517.72
8.1.20.0150.00517.73
8.1.10.0130.00517.66
8.1.00.0130.00517.63
8.0.300.0170.00418.80
8.0.290.0170.00617.16
8.0.280.0070.00517.94
8.0.270.0090.00417.38
8.0.260.0070.00717.28
8.0.250.0090.00217.15
8.0.240.0100.00417.12
8.0.230.0110.00417.14
8.0.220.0120.00317.08
8.0.210.0120.00317.03
8.0.200.0110.00417.11
8.0.190.0110.00317.10
8.0.180.0100.00417.01
8.0.170.0100.00417.07
8.0.160.0090.00517.06
8.0.150.0100.00517.00
8.0.140.0080.00616.96
8.0.130.0120.00316.62
8.0.120.0090.00616.97
8.0.110.0100.00417.04
8.0.100.0100.00517.02
8.0.90.0110.00317.02
8.0.80.0120.00317.04
8.0.70.0100.00516.94
8.0.60.0100.00516.97
8.0.50.0080.00716.97
8.0.30.0100.00617.00
8.0.20.0100.00617.17
8.0.10.0100.00517.12
8.0.00.0080.00517.65
7.4.330.0090.00315.76
7.4.320.0100.00216.76
7.4.300.0100.00416.98
7.4.290.0090.00516.96
7.4.280.0110.00416.68
7.4.270.0080.00716.91
7.4.260.0120.00416.94
7.4.250.0120.00316.92
7.4.240.0100.00516.88
7.4.230.0100.00516.63
7.4.220.0110.00416.89
7.4.210.0080.00516.86
7.4.200.0110.00416.85
7.4.190.0120.00416.80
7.4.180.0100.00416.98
7.4.160.0110.00416.88
7.4.150.0100.00616.97
7.4.140.0090.00617.06
7.4.130.0090.00616.63
7.4.120.0100.00516.62
7.4.110.0080.00616.55
7.4.100.0110.00516.58
7.4.90.0100.00516.66
7.4.80.0090.00616.81
7.4.70.0090.00516.54
7.4.60.0130.00416.59
7.4.50.0110.00516.48
7.4.40.0100.00516.52
7.4.30.0090.00616.59
7.4.20.0090.00416.60
7.4.10.0080.00616.62
7.4.00.0070.00516.74
7.3.330.0100.00416.25
7.3.320.0110.00416.25
7.3.310.0100.00516.55
7.3.300.0090.00516.60
7.3.290.0090.00616.56
7.3.280.0110.00716.55
7.3.270.0120.00516.65
7.3.260.0130.00516.55
7.3.250.0090.00816.56
7.3.240.0100.00616.57
7.3.230.0140.00216.55
7.3.220.0130.00416.46
7.3.210.0130.00616.50
7.3.200.0110.00616.41
7.3.190.0110.00516.49
7.3.180.0110.00516.50
7.3.170.0130.00316.52
7.3.160.0120.00416.56
7.3.150.0120.00416.56
7.3.140.0120.00516.51
7.3.130.0140.00316.56
7.3.120.0120.00316.30
7.3.110.0110.00516.29
7.3.100.0120.00416.32
7.3.90.0120.00416.58
7.3.80.0100.00616.39
7.3.70.0100.00616.35
7.3.60.0100.00516.42
7.3.50.0120.00416.43
7.3.40.0120.00316.34
7.3.30.0100.00616.39
7.3.20.0120.00417.52
7.3.10.0130.00517.41
7.3.00.0100.00617.39
7.2.340.0100.00416.81
7.2.330.0110.00616.61
7.2.320.0160.00416.64
7.2.310.0110.00716.67
7.2.300.0140.00516.64
7.2.290.0130.00516.65
7.2.280.0120.00616.65
7.2.270.0130.00516.67
7.2.260.0120.00616.64
7.2.250.0130.00516.66
7.2.240.0110.00516.42
7.2.230.0110.00516.47
7.2.220.0110.00616.50
7.2.210.0110.00516.46
7.2.200.0110.00616.56
7.2.190.0090.00716.55
7.2.180.0120.00516.51
7.2.170.0120.00416.53
7.2.160.0110.00516.53
7.2.150.0100.00617.67
7.2.140.0130.00417.70
7.2.130.0100.00717.65
7.2.120.0100.00717.61
7.2.110.0120.00417.62
7.2.100.0140.00417.62
7.2.90.0130.00617.62
7.2.80.0110.00717.62
7.2.70.0120.00717.60
7.2.60.0110.00617.52
7.2.50.0120.00617.65
7.2.40.0120.00617.67
7.2.30.0120.00517.67
7.2.20.0090.00717.66
7.2.10.0110.00617.78
7.2.00.0110.00617.90
7.1.330.0100.00516.81
7.1.320.0110.00616.79
7.1.310.0110.00516.77
7.1.300.0110.00516.81
7.1.290.0130.00416.79
7.1.280.0090.00716.75
7.1.270.0100.00416.77
7.1.260.0140.00516.79
7.1.250.0110.00316.66
7.1.240.0110.00516.84
7.1.230.0120.00516.87
7.1.220.0110.00516.88
7.1.210.0110.00616.89
7.1.200.0110.00516.80
7.1.190.0180.00516.89
7.1.180.0130.00416.89
7.1.170.0120.00617.02
7.1.160.0110.00716.84
7.1.150.0140.00416.82
7.1.140.0140.00416.82
7.1.130.0130.00616.82
7.1.120.0130.00616.79
7.1.110.0140.00416.84
7.1.100.0120.00516.93
7.1.90.0120.00716.79
7.1.80.0200.00316.81
7.1.70.0130.00516.82
7.1.60.0100.00616.88
7.1.50.0110.00616.89
7.1.40.0110.00616.92
7.1.30.0120.00516.96
7.1.20.0120.00416.85
7.1.10.0110.00716.84
7.1.00.0120.01117.36
7.0.330.0120.00416.62
7.0.320.0130.00216.63
7.0.310.0130.00516.61
7.0.300.0110.00416.63
7.0.290.0100.00516.64
7.0.280.0120.00416.60
7.0.270.0100.00616.64
7.0.260.0110.00516.60
7.0.250.0120.00416.66
7.0.240.0130.00416.70
7.0.230.0090.00616.67
7.0.220.0120.00416.67
7.0.210.0110.00516.65
7.0.200.0150.00216.45
7.0.190.0140.00516.64
7.0.180.0100.00516.61
7.0.170.0120.00416.79
7.0.160.0130.00416.68
7.0.150.0150.00416.70
7.0.140.0100.00616.64
7.0.130.0120.00316.67
7.0.120.0140.00416.68
7.0.110.0120.01416.98
7.0.100.0120.01217.00
7.0.90.0170.01016.95
7.0.80.0120.01216.98
7.0.70.0110.01316.94
7.0.60.0120.00916.99
7.0.50.0100.01316.98
7.0.40.0110.01317.04
7.0.30.0130.00816.98
7.0.20.0150.01117.00
7.0.10.0110.01117.04
7.0.00.0100.01316.97
5.6.400.0090.00616.13
5.6.390.0120.00416.14
5.6.380.0120.00516.13
5.6.370.0100.00616.15
5.6.360.0110.00616.11
5.6.350.0100.00616.16
5.6.340.0110.00416.12
5.6.330.0100.00516.12
5.6.320.0120.00316.11
5.6.310.0120.00416.19
5.6.300.0120.00416.11
5.6.290.0100.00516.22
5.6.280.0110.00516.20
5.6.270.0120.00416.20
5.6.260.0120.00516.13
5.6.250.0120.01216.62
5.6.240.0110.01216.59
5.6.230.0090.01316.73
5.6.220.0100.01216.75
5.6.210.0100.01416.74
5.6.200.0100.01316.72
5.6.190.0080.01416.72
5.6.180.0100.01216.72
5.6.170.0130.01016.80
5.6.160.0100.01316.81
5.6.150.0120.01116.74
5.6.140.0110.01216.72
5.6.130.0100.01216.73
5.6.120.0090.01416.75
5.6.110.0110.01116.69
5.6.100.0090.01116.66
5.6.90.0120.01116.64
5.6.80.0090.01216.60
5.6.70.0090.01216.70
5.6.60.0120.01016.73
5.6.50.0110.01016.61
5.6.40.0080.01016.66
5.6.30.0100.01116.64
5.6.20.0100.01116.68
5.6.10.0090.01316.69
5.6.00.0090.01316.60
5.5.280.0140.03425.66
5.4.120.0120.00530.84

preferences:
39.14 ms | 403 KiB | 5 Q