3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Encryption { // The key const KEY = 'EB648D0BFCA30CADC75634B10C5A3A341F8BDC268069CA2F2EB79D3BF8D58D00'; /** * Encrypt a string * * @access public * @static * @param string $string * @return string */ public static function encrypt($string) { return mcrypt_encrypt(MCRYPT_RIJNDAEL_256, self::getMySQLKey(self::KEY), self::getPaddedString($string), MCRYPT_MODE_CBC, self::KEY); } /** * Decrypt a string * * @access public * @static * @param string $string * @return string */ public static function decrypt($string) { return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, self::getMySQLKey(self::KEY), $string, MCRYPT_MODE_CBC, self::KEY), "\x00..\x10"); } /** * Get MySQL key * * @access public * @static * @param string $key * @return string */ public static function getMySQLKey($key) { // The new key $new_key = str_repeat(chr(0), 32); // Iterate over the key and XOR for ($i = 0, $l = strlen($key); $i < $l; ++$i) { $new_key[$i % 32] = $new_key[$i % 32] ^ $key[$i]; } // Return the new key return $new_key; } /** * Get padded string * * @access public * @static * @param string $string * @return string */ public static function getPaddedString($string) { return str_pad($string, (16 * (floor(strlen($string) / 16) + 1)), chr(16 - (strlen($string) % 16))); } } echo base64_encode(Encryption::encrypt('michael@example.com'));

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.0110.00418.84
8.3.30.0110.00418.67
8.3.20.0090.00920.33
8.3.10.0110.00421.90
8.3.00.0000.00823.65
8.2.170.0140.00022.96
8.2.160.0030.01020.14
8.2.150.0000.00924.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0070.00021.00
8.2.110.0110.00021.01
8.2.100.0090.00317.91
8.2.90.0050.00319.28
8.2.80.0030.00517.97
8.2.70.0080.00017.49
8.2.60.0060.00317.80
8.2.50.0070.00318.09
8.2.40.0030.00522.38
8.2.30.0000.00719.30
8.2.20.0040.00417.79
8.2.10.0040.00417.92
8.2.00.0070.00018.10
8.1.270.0000.00822.19
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0060.00323.84
8.1.230.0040.00818.86
8.1.220.0060.00617.74
8.1.210.0000.00818.77
8.1.200.0060.00617.35
8.1.190.0080.00016.99
8.1.180.0080.00018.10
8.1.170.0040.00418.50
8.1.160.0050.00220.74
8.1.150.0070.00019.05
8.1.140.0040.00419.36
8.1.130.0070.00017.56
8.1.120.0030.00317.27
8.1.110.0040.00417.27
8.1.100.0050.00317.41
8.1.90.0070.00017.26
8.1.80.0040.00317.28
8.1.70.0000.00717.38
8.1.60.0030.00617.58
8.1.50.0040.00417.36
8.1.40.0000.00817.34
8.1.30.0030.00617.48
8.1.20.0040.00417.63
8.1.10.0000.00717.55
8.1.00.0000.00817.53
8.0.300.0050.00218.77
8.0.290.0000.00916.75
8.0.280.0040.00418.43
8.0.270.0080.00017.25
8.0.260.0030.00517.23
8.0.250.0000.00716.88
8.0.240.0050.00216.89
8.0.230.0000.00716.98
8.0.220.0050.00316.92
8.0.210.0040.00416.94
8.0.200.0040.00417.04
8.0.190.0040.00417.04
8.0.180.0000.00816.98
8.0.170.0070.00016.94
8.0.160.0040.00416.93
8.0.150.0050.00216.77
8.0.140.0030.00516.96
8.0.130.0000.00713.36
8.0.120.0040.00416.81
8.0.110.0000.00716.91
8.0.100.0040.00416.92
8.0.90.0050.00217.00
8.0.80.0120.00316.91
8.0.70.0050.00316.78
8.0.60.0000.00817.04
8.0.50.0000.00816.97
8.0.30.0100.00717.01
8.0.20.0100.01217.40
8.0.10.0040.00416.90
8.0.00.0110.00816.81
7.4.330.0020.00216.88
7.4.320.0030.00316.49
7.4.300.0040.00416.53
7.4.290.0040.00416.46
7.4.280.0000.01216.39
7.4.270.0000.00716.44
7.4.260.0070.00016.47
7.4.250.0070.00016.55
7.4.240.0000.00816.59
7.4.230.0070.00016.61
7.4.220.0110.01416.61
7.4.210.0040.01116.63
7.4.200.0030.00316.48
7.4.160.0100.00716.48
7.4.150.0140.00917.40
7.4.140.0070.01117.86
7.4.130.0090.00916.58
7.4.120.0100.01016.66
7.4.110.0120.00616.70
7.4.100.0140.00716.46
7.4.90.0070.01016.60
7.4.80.0130.01019.39
7.4.70.0110.00816.66
7.4.60.0090.00916.58
7.4.50.0090.00616.34
7.4.40.0050.01116.27
7.4.30.0090.01016.56
7.4.00.0070.01015.09
7.3.330.0040.00413.37
7.3.320.0000.00513.24
7.3.310.0000.00716.41
7.3.300.0000.00716.39
7.3.290.0080.00616.33
7.3.280.0050.01216.37
7.3.270.0190.03517.40
7.3.260.0120.00616.56
7.3.250.0120.00816.29
7.3.240.0080.00816.48
7.3.230.0140.00316.43
7.3.210.0030.01316.27
7.3.200.0060.01619.39
7.3.190.0030.01416.48
7.3.180.0000.01616.46
7.3.170.0090.00916.34
7.3.160.0110.00516.23
7.3.10.0140.00916.43
7.3.00.0150.00715.53
7.2.330.0060.01216.27
7.2.320.0040.01416.63
7.2.310.0030.01416.64
7.2.300.0120.00916.63
7.2.290.0060.01116.28
7.2.130.0130.00815.86
7.2.120.0210.00416.83
7.2.110.0220.00415.88
7.2.100.0150.01115.77
7.2.90.0080.01916.75
7.2.80.0170.00616.48
7.2.70.0160.00616.29
7.2.60.0120.00516.54
7.2.50.0180.01116.57
7.2.40.0270.00016.20
7.2.30.0130.01116.39
7.2.20.0140.00716.20
7.2.10.0180.00316.27
7.2.00.0070.00617.90
7.1.250.0130.00515.16
7.1.200.0070.00715.63
7.1.100.0070.00718.15
7.1.70.0030.00616.96
7.1.60.0090.01619.40
7.1.50.0040.00816.59
7.1.00.0030.07722.50
7.0.200.0270.00814.96
7.0.60.0200.07721.73
7.0.50.0070.04317.94
7.0.40.0070.04020.18
7.0.30.0330.04320.17
7.0.20.0230.05720.23
7.0.10.0170.08320.11
7.0.00.0100.03720.32
5.6.280.0000.03721.16
5.6.210.0030.04320.77
5.6.200.0070.06318.19
5.6.190.0030.05720.81
5.6.180.0170.04320.50
5.6.170.0270.04320.60
5.6.160.0030.06020.53
5.6.150.0070.08018.14
5.6.140.0130.03718.28
5.6.130.0030.04318.18
5.6.120.0100.04021.24
5.6.110.0130.08021.13
5.6.100.0170.07021.13
5.6.90.0030.07321.04
5.6.80.0100.06320.41
5.5.350.0030.04720.40
5.5.340.0070.04018.02
5.5.330.0070.08020.49
5.5.320.0770.05720.36
5.5.310.0400.06020.45
5.5.300.0100.07317.99
5.5.290.0100.08018.00
5.5.280.0130.06720.93
5.5.270.0070.05720.74
5.5.260.0100.07720.95
5.5.250.0100.08720.63
5.5.240.0130.03020.25

preferences:
47.44 ms | 400 KiB | 5 Q