3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(1); ini_set('display_errors', 1); class Encryption { private $key = "myKeyIs"; protected $iv_size; protected $iv; public function __construct(){ $this->iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $this->iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); } public function encryptData($input) { $input = trim($input); $output = $this->encrypt($input); return $output; } public function decryptData($input) { $input = base64_decode(base64_decode($input)); $output = $this->decrypt($input); return $output; } public function decrypt($string) { $string = base64_decode($string); # retrieves the IV, iv_size should be created using mcrypt_get_iv_size() $iv_dec = substr($string, 0, $this->iv_size); # retrieves the cipher text (everything except the $iv_size in the front) $string = substr($string, $this->iv_size); # may remove 00h valued characters from end of plain text $output = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $this->key, $string, MCRYPT_MODE_CBC, $iv_dec); return $output; } public function encrypt($string) { $output = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->key, $string, MCRYPT_MODE_CBC, $this->iv); # prepend the IV for it to be available for decryption $output = $this->iv . $output; # encode the resulting cipher text so it can be represented by a string $output = base64_encode($output); return $output; } } $test = new Encryption(); echo $encrypted = $test->encryptData("Narendra"); echo "\n"; echo $test->decryptData($encrypted);

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.87
8.3.30.0120.00318.79
8.3.20.0040.00420.20
8.3.10.0030.00623.51
8.3.00.0060.00319.51
8.2.170.0140.01018.96
8.2.160.0150.00022.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0040.00420.56
8.2.120.0070.00026.35
8.2.110.0030.00920.52
8.2.100.0100.00317.80
8.2.90.0000.00819.27
8.2.80.0030.00617.97
8.2.70.0000.00817.50
8.2.60.0090.00017.93
8.2.50.0050.00318.07
8.2.40.0050.00320.96
8.2.30.0040.00420.71
8.2.20.0030.00517.64
8.2.10.0060.00318.13
8.2.00.0040.00417.94
8.1.270.0030.01123.66
8.1.260.0000.00728.09
8.1.250.0080.00028.09
8.1.240.0100.00018.99
8.1.230.0060.00617.54
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.25
8.1.190.0000.00817.57
8.1.180.0000.00718.10
8.1.170.0040.00418.65
8.1.160.0000.00721.90
8.1.150.0000.00718.79
8.1.140.0040.00419.43
8.1.130.0000.00717.59
8.1.120.0030.00617.44
8.1.110.0040.00417.29
8.1.100.0080.00017.27
8.1.90.0070.00017.25
8.1.80.0000.00717.24
8.1.70.0030.00317.27
8.1.60.0030.00717.52
8.1.50.0060.00317.38
8.1.40.0000.00817.48
8.1.30.0000.00817.53
8.1.20.0030.00517.41
8.1.10.0000.00717.57
8.1.00.0040.00417.41
8.0.300.0080.00018.77
8.0.290.0000.00716.75
8.0.280.0080.00018.32
8.0.270.0050.00217.23
8.0.260.0000.00617.13
8.0.250.0000.00616.85
8.0.240.0030.00316.88
8.0.230.0030.00316.94
8.0.220.0000.00716.98
8.0.210.0000.00716.96
8.0.200.0000.00716.84
8.0.190.0040.00416.99
8.0.180.0000.00716.98
8.0.170.0080.00016.83
8.0.160.0030.00316.80
8.0.150.0050.00216.85
8.0.140.0050.00216.88
8.0.130.0030.00313.41
8.0.120.0030.00617.00
8.0.110.0030.00516.74
8.0.100.0040.00416.83
8.0.90.0040.00416.87
8.0.80.0060.00916.98
8.0.70.0040.00417.00
8.0.60.0030.00516.94
8.0.50.0000.00716.98
8.0.30.0090.00716.99
8.0.20.0110.01117.40
8.0.10.0040.00416.92
8.0.00.0110.00616.60
7.4.330.0020.00216.73
7.4.320.0030.00316.36
7.4.300.0060.00016.61
7.4.290.0000.00716.46
7.4.280.0000.00916.41
7.4.270.0030.00316.53
7.4.260.0000.00816.44
7.4.250.0070.00016.51
7.4.240.0020.00516.45
7.4.230.0040.00416.64
7.4.220.0090.01216.48
7.4.210.0110.00316.45
7.4.200.0000.00716.55
7.4.160.0100.00716.51
7.4.150.0100.00717.40
7.4.140.0080.01117.86
7.4.130.0100.01316.63
7.4.120.0170.00316.56
7.4.110.0070.01016.54
7.4.100.0070.01116.44
7.4.90.0090.00916.54
7.4.80.0100.01319.39
7.4.70.0120.00616.44
7.4.60.0040.01316.63
7.4.50.0000.01316.61
7.4.40.0100.00616.26
7.4.30.0050.01216.51
7.4.10.0100.00714.79
7.4.00.0080.00914.91
7.3.330.0000.00613.39
7.3.320.0050.00013.44
7.3.310.0050.00216.39
7.3.300.0030.00316.29
7.3.290.0090.00616.36
7.3.280.0070.00816.37
7.3.270.0070.01117.40
7.3.260.0080.00816.34
7.3.250.0080.01116.50
7.3.240.0110.00516.37
7.3.230.0120.00616.39
7.3.210.0030.01916.48
7.3.200.0060.01016.45
7.3.190.0110.00716.49
7.3.180.0090.00916.32
7.3.170.0130.00716.46
7.3.160.0090.01216.41
7.3.130.0000.01814.61
7.3.120.0060.01214.76
7.3.110.0060.01314.70
7.3.100.0090.00614.75
7.3.90.0040.01014.84
7.3.80.0050.00814.74
7.3.70.0060.00814.84
7.3.60.0060.01114.84
7.3.50.0030.00914.74
7.3.40.0040.00714.72
7.3.30.0020.00914.84
7.3.20.0030.00916.63
7.3.10.0050.01116.56
7.3.00.0020.00916.56
7.2.330.0170.00016.52
7.2.320.0030.01516.75
7.2.310.0110.00616.74
7.2.300.0080.01116.32
7.2.290.0130.00316.71
7.2.260.0060.01214.98
7.2.250.0080.01014.77
7.2.240.0070.01214.86
7.2.230.0070.00814.85
7.2.220.0080.00814.88
7.2.210.0060.00914.89
7.2.200.0060.00714.88
7.2.190.0080.00714.96
7.2.180.0080.00614.91
7.2.170.0020.01014.94
7.2.160.0060.00614.65
7.2.150.0040.01116.63
7.2.140.0040.00816.70
7.2.130.0080.00516.72
7.2.120.0060.00616.77
7.2.110.0050.01116.55
7.2.100.0090.00516.74
7.2.90.0060.00716.71
7.2.80.0050.00916.64
7.2.70.0080.00416.77
7.2.60.0030.01016.62
7.2.50.0090.00616.88
7.2.40.0050.00816.89
7.2.30.0080.00616.68
7.2.20.0080.00716.80
7.2.10.0070.00716.72
7.2.00.0040.00917.39
7.1.330.0080.00915.58
7.1.320.0070.00715.61
7.1.310.0030.00615.60
7.1.300.0040.00915.62
7.1.290.0000.01315.57
7.1.280.0040.00815.63
7.1.270.0060.00715.65
7.1.260.0070.00715.56
7.1.250.0050.00815.73
7.1.240.0070.00615.51
7.1.230.0060.00715.60
7.1.220.0040.00915.65
7.1.210.0070.00715.58
7.1.200.0070.00515.65
7.1.190.0030.01115.74
7.1.180.0030.00815.58
7.1.170.0010.01015.67
7.1.160.0030.01015.50
7.1.150.0070.00715.73
7.1.140.0030.01015.71
7.1.130.0040.00915.67
7.1.120.0050.00715.54
7.1.110.0020.01215.66
7.1.100.0070.00716.31
7.1.90.0040.00715.49
7.1.80.0090.00415.73
7.1.70.0030.00715.97
7.1.60.0060.01116.67
7.1.50.0060.00916.04
7.1.40.0030.00915.74
7.1.30.0040.00815.57
7.1.20.0050.00515.65
7.1.10.0050.00515.55
7.1.00.0080.02217.29
7.0.330.0040.00715.26
7.0.320.0050.00715.43
7.0.310.0010.01015.29
7.0.300.0050.00915.20
7.0.290.0090.00515.38
7.0.280.0070.00915.36
7.0.270.0060.00815.09
7.0.260.0060.00815.18
7.0.250.0060.00715.38
7.0.240.0040.00615.38
7.0.230.0020.00915.31
7.0.220.0060.00515.25
7.0.210.0030.01115.32
7.0.200.0050.00615.67
7.0.190.0080.00315.34
7.0.180.0090.00315.20
7.0.170.0040.00915.38
7.0.160.0070.00415.42
7.0.150.0050.00615.32
7.0.140.0070.00615.33
7.0.130.0050.00915.40
7.0.120.0020.01115.29
7.0.110.0040.01115.33
7.0.100.0060.00815.21
7.0.90.0030.01015.24
7.0.80.0030.01015.15
7.0.70.0060.00815.27
7.0.60.0110.02316.46
7.0.50.0040.01916.10
7.0.40.0070.02215.28
7.0.30.0070.01915.31
7.0.20.0100.01815.32
7.0.10.0060.02215.24
7.0.00.0070.01915.29
5.6.400.0050.00614.33
5.6.390.0040.01114.17
5.6.380.0040.00714.29
5.6.370.0030.00914.42
5.6.360.0070.00714.31
5.6.350.0030.00714.23
5.6.340.0070.00414.12
5.6.330.0040.00814.16
5.6.320.0070.00914.33
5.6.310.0020.01114.13
5.6.300.0050.00914.34
5.6.290.0060.00714.16
5.6.280.0050.02215.97
5.6.270.0030.00714.16
5.6.260.0080.00714.19
5.6.250.0060.00914.24
5.6.240.0020.01214.19
5.6.230.0030.00814.16
5.6.220.0090.00414.36
5.6.210.0040.01815.82
5.6.200.0080.02015.32
5.6.190.0050.02015.78
5.6.180.0180.02115.90
5.6.170.0090.02015.85
5.6.160.0070.01415.79
5.6.150.0070.01415.29
5.6.140.0060.01615.35
5.6.130.0060.02115.18
5.6.120.0060.02915.93
5.6.110.0060.02715.95
5.6.100.0060.02715.88
5.6.90.0080.02615.91
5.6.80.0100.01615.62
5.6.70.0070.00514.18
5.6.60.0040.00914.13
5.6.50.0050.00714.30
5.6.40.0040.01114.12
5.6.30.0070.00814.20
5.6.20.0040.00814.27
5.6.10.0050.01014.34
5.6.00.0040.01014.25
5.5.380.0050.01014.04
5.5.370.0080.00714.05
5.5.360.0050.00914.23
5.5.350.0080.02715.67
5.5.340.0030.02415.20
5.5.330.0060.01415.67
5.5.320.0040.02815.61
5.5.310.0100.01515.64
5.5.300.0060.02715.17
5.5.290.0060.02215.09
5.5.280.0060.01615.86
5.5.270.0050.01415.74
5.5.260.0080.02415.88
5.5.250.0090.02415.71
5.5.240.0090.02715.57
5.5.230.0060.00714.13
5.5.220.0050.00614.10
5.5.210.0050.00714.03
5.5.200.0030.00814.11
5.5.190.0050.00714.19
5.5.180.0080.00614.05
5.5.170.0070.00814.21
5.5.160.0070.00514.06
5.5.150.0070.00914.26
5.5.140.0080.00714.01
5.5.130.0040.00914.02
5.5.120.0060.00714.10
5.5.110.0070.00913.99
5.5.100.0040.00914.03
5.5.90.0040.00914.04
5.5.80.0050.00814.10
5.5.70.0050.01014.06
5.5.60.0060.00813.95
5.5.50.0070.00514.08
5.5.40.0010.01314.30
5.5.30.0070.00814.06
5.5.20.0060.00714.17
5.5.10.0100.00314.22
5.5.00.0060.00614.06

preferences:
46.84 ms | 400 KiB | 5 Q