3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Encryption { // The key const KEY = '36F3D40A7A41A827968BE75A87D60950'; /** * 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) { $key .= $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.60.0060.00916.63
8.3.50.0170.00721.14
8.3.40.0130.01018.92
8.3.30.0040.01118.84
8.3.20.0040.01420.38
8.3.10.0140.00323.67
8.3.00.0070.00321.82
8.2.180.0130.00916.88
8.2.170.0110.01122.96
8.2.160.0140.00020.36
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0080.00021.13
8.2.120.0080.00026.35
8.2.110.0110.00022.26
8.2.100.0120.00017.80
8.2.90.0000.00819.17
8.2.80.0030.00517.97
8.2.70.0040.00417.50
8.2.60.0000.00817.68
8.2.50.0040.00418.09
8.2.40.0080.00022.20
8.2.30.0040.00319.32
8.2.20.0060.00317.83
8.2.10.0040.00418.12
8.2.00.0040.00417.95
8.1.280.0040.01225.92
8.1.270.0040.00423.83
8.1.260.0040.00428.09
8.1.250.0050.00328.09
8.1.240.0080.00022.14
8.1.230.0040.00717.83
8.1.220.0000.00917.79
8.1.210.0000.00818.77
8.1.200.0000.00917.10
8.1.190.0030.00517.22
8.1.180.0040.00418.10
8.1.170.0030.00618.47
8.1.160.0070.00020.73
8.1.150.0030.00518.91
8.1.140.0050.00319.50
8.1.130.0000.00817.60
8.1.120.0000.00717.28
8.1.110.0000.00717.36
8.1.100.0020.00517.44
8.1.90.0040.00417.42
8.1.80.0050.00317.43
8.1.70.0000.00717.30
8.1.60.0030.00517.61
8.1.50.0060.00317.50
8.1.40.0080.00017.54
8.1.30.0080.00017.55
8.1.20.0040.00417.67
8.1.10.0040.00417.56
8.1.00.0040.00417.55
8.0.300.0080.00018.77
8.0.290.0070.00016.75
8.0.280.0000.00718.43
8.0.270.0000.00717.23
8.0.260.0000.00817.14
8.0.250.0030.00416.95
8.0.240.0030.00317.04
8.0.230.0040.00317.02
8.0.220.0000.00716.91
8.0.210.0000.00716.94
8.0.200.0000.00817.04
8.0.190.0030.00616.98
8.0.180.0000.00716.82
8.0.170.0060.00317.00
8.0.160.0040.00416.85
8.0.150.0000.00816.97
8.0.140.0040.00416.87
8.0.130.0050.00313.32
8.0.120.0050.00316.95
8.0.110.0000.00716.85
8.0.100.0030.00516.82
8.0.90.0000.00717.05
8.0.80.0100.00716.89
8.0.70.0040.00416.73
8.0.60.0000.00816.98
8.0.50.0020.00516.81
8.0.30.0160.00317.04
8.0.20.0050.01317.40
8.0.10.0040.00417.04
8.0.00.0070.01216.67
7.4.330.0000.00516.82
7.4.320.0000.00616.45
7.4.300.0030.00316.46
7.4.290.0080.00316.43
7.4.280.0110.00016.38
7.4.270.0000.00816.38
7.4.260.0000.00816.56
7.4.250.0030.00516.45
7.4.240.0040.00416.59
7.4.230.0030.00316.59
7.4.220.0190.00016.51
7.4.210.0070.00716.64
7.4.200.0030.00316.40
7.4.160.0130.00316.60
7.4.150.0090.00917.40
7.4.140.0100.01117.86
7.4.130.0090.00816.64
7.4.120.0090.00816.55
7.4.110.0040.01416.31
7.4.100.0070.01416.31
7.4.90.0060.01116.56
7.4.80.0110.00719.39
7.4.70.0120.00616.56
7.4.60.0090.00616.46
7.4.50.0000.01416.31
7.4.40.0130.00316.73
7.4.30.0030.01816.54
7.4.00.0080.00814.96
7.3.330.0060.00013.23
7.3.320.0000.00513.39
7.3.310.0030.00316.27
7.3.300.0000.00716.23
7.3.290.0080.00916.35
7.3.280.0100.00816.39
7.3.270.0100.00717.40
7.3.260.0000.01816.41
7.3.250.0110.00816.38
7.3.240.0150.00516.56
7.3.230.0070.01116.56
7.3.210.0030.01316.25
7.3.200.0060.01616.65
7.3.190.0030.01316.30
7.3.180.0030.01316.40
7.3.170.0060.01316.38
7.3.160.0120.00316.48
7.3.120.0000.01214.46
7.3.110.0080.00814.54
7.3.100.0060.01014.53
7.3.90.0110.00614.90
7.3.80.0060.00614.80
7.3.70.0000.00914.93
7.3.60.0000.01414.55
7.3.50.0130.00314.55
7.3.40.0000.01214.89
7.3.30.0030.00814.63
7.3.20.0090.00616.43
7.3.10.0030.01016.61
7.3.00.0070.00816.47
7.2.330.0150.00316.77
7.2.320.0030.01816.58
7.2.310.0030.01316.47
7.2.300.0070.01116.36
7.2.290.0040.01616.55
7.2.250.0040.01514.75
7.2.240.0070.01415.13
7.2.230.0080.01114.79
7.2.220.0030.01215.07
7.2.210.0030.00914.70
7.2.200.0070.00315.03
7.2.190.0040.00814.84
7.2.180.0070.00714.77
7.2.170.0100.00314.68
7.2.130.0100.00716.34
7.2.120.0100.00316.39
7.2.110.0150.00016.55
7.2.100.0080.00416.78
7.2.90.0110.00716.84
7.2.80.0090.00616.59
7.2.70.0040.00816.19
7.2.60.0100.00416.51
7.2.50.0040.01116.83
7.2.40.0070.00716.29
7.2.30.0120.00316.75
7.2.20.0070.00716.82
7.2.10.0160.00016.66
7.2.00.0040.00618.04
7.1.330.0000.01615.48
7.1.320.0040.01115.41
7.1.310.0030.00915.25
7.1.300.0030.00715.47
7.1.290.0050.00515.46
7.1.280.0080.00815.59
7.1.270.0040.00815.72
7.1.260.0040.01415.70
7.1.250.0120.00615.34
7.1.240.0060.00915.30
7.1.230.0060.01015.09
7.1.220.0090.00915.49
7.1.210.0070.00715.71
7.1.200.0060.00615.56
7.1.190.0060.00915.36
7.1.180.0160.00015.23
7.1.170.0060.00915.21
7.1.160.0060.00615.69
7.1.150.0110.00715.76
7.1.140.0070.00715.47
7.1.130.0100.00715.39
7.1.120.0060.00615.70
7.1.110.0080.00815.68
7.1.100.0060.00816.54
7.1.90.0110.00315.27
7.1.80.0070.01115.41
7.1.70.0020.00816.16
7.1.60.0080.01317.39
7.1.50.0060.01316.04
7.1.40.0090.00915.04
7.1.30.0070.01015.50
7.1.20.0030.01715.23
7.1.10.0100.01015.11
7.1.00.0100.03718.78
7.0.330.0080.00415.08
7.0.320.0170.00315.03
7.0.310.0120.01215.35
7.0.300.0040.02015.45
7.0.290.0070.00715.19
7.0.280.0130.00015.20
7.0.270.0100.00714.91
7.0.260.0070.00714.93
7.0.250.0140.00615.34
7.0.240.0100.00714.43
7.0.230.0090.00914.79
7.0.220.0150.00015.33
7.0.210.0130.00315.05
7.0.200.0300.00814.84
7.0.190.0040.00814.89
7.0.180.0090.00315.10
7.0.170.0100.00715.29
7.0.160.0070.00715.31
7.0.150.0100.00315.02
7.0.140.0080.00514.98
7.0.130.0080.00815.13
7.0.120.0070.01015.16
7.0.110.0070.00714.98
7.0.100.0030.01014.98
7.0.90.0040.00815.21
7.0.80.0110.00415.33
7.0.70.0060.00615.09
7.0.60.0140.04318.45
7.0.50.0090.01816.59
7.0.40.0070.04416.71
7.0.30.0130.03816.57
7.0.20.0150.04116.79
7.0.10.0030.02916.73
7.0.00.0070.04816.82
5.6.380.0040.01114.18
5.6.370.0080.00313.53
5.6.360.0000.01114.20
5.6.350.0120.00013.93
5.6.340.0000.00713.98
5.6.330.0100.00313.61
5.6.320.0080.00613.78
5.6.310.0060.01013.96
5.6.300.0000.01113.93
5.6.290.0000.01413.93
5.6.280.0000.02417.63
5.6.270.0030.00914.09
5.6.260.0070.00414.08
5.6.250.0000.01213.87
5.6.240.0040.00813.68
5.6.230.0000.00713.89
5.6.220.0060.00614.02
5.6.210.0120.04317.09
5.6.200.0080.04015.98
5.6.190.0050.04817.30
5.6.180.0050.04717.09
5.6.170.0150.03017.14
5.6.160.0040.02417.33
5.6.150.0080.01816.07
5.6.140.0060.04515.95
5.6.130.0050.02815.86
5.6.120.0140.04217.44
5.6.110.0070.02317.62
5.6.100.0050.02517.55
5.6.90.0000.02817.76
5.6.80.0050.04617.12
5.6.70.0060.00613.91
5.6.60.0040.00814.07
5.6.50.0090.00614.02
5.6.40.0060.00613.86
5.6.30.0050.00513.55
5.6.20.0100.00713.82
5.6.10.0040.01113.94
5.6.00.0030.00913.87
5.5.380.0000.01010.90
5.5.370.0030.00310.90
5.5.360.0070.00011.05
5.5.350.0020.02715.70
5.5.340.0050.02314.45
5.5.330.0050.02015.61
5.5.320.0250.03015.64
5.5.310.0200.03815.61
5.5.300.0110.04014.50
5.5.290.0100.04014.45
5.5.280.0060.02915.98
5.5.270.0090.04415.90
5.5.260.0000.03916.06
5.5.250.0070.04515.78
5.5.240.0070.02615.67
5.5.230.0000.01110.90
5.5.220.0000.01111.03
5.5.210.0040.00710.90
5.5.200.0040.00711.09
5.5.190.0110.00010.90
5.5.180.0000.00710.90
5.5.170.0000.01110.90
5.5.160.0040.00410.93
5.5.150.0030.00610.90
5.5.140.0050.00311.05
5.5.130.0030.01010.90
5.5.120.0040.00410.97
5.5.110.0040.00410.90
5.5.100.0040.00710.94
5.5.90.0030.00310.90
5.5.80.0000.01210.90
5.5.70.0040.00810.90
5.5.60.0100.00010.90
5.5.50.0000.00810.90
5.5.40.0030.00910.90
5.5.30.0080.00410.90
5.5.20.0080.00411.09
5.5.10.0030.00910.96
5.5.00.0040.00410.90

preferences:
44.44 ms | 401 KiB | 5 Q