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 = trim($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 . $ciphertext; # encode the resulting cipher text so it can be represented by a string $output = base64_encode($ciphertext); return $output; } } $test = new Encryption(); echo $test->encryptData("Narendra")."<br>"; echo $test->decryptData("Narendra");

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.0070.00716.88
8.3.50.0130.00618.02
8.3.40.0100.01018.79
8.3.30.0070.00718.72
8.3.20.0020.00520.30
8.3.10.0000.00823.70
8.3.00.0030.00519.51
8.2.180.0090.00916.63
8.2.170.0100.01022.96
8.2.160.0100.00320.35
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00820.52
8.2.120.0000.00826.35
8.2.110.0070.00319.25
8.2.100.0140.00017.78
8.2.90.0000.00817.91
8.2.80.0000.00919.70
8.2.70.0000.00817.63
8.2.60.0040.00417.50
8.2.50.0000.00818.07
8.2.40.0000.00819.38
8.2.30.0030.00320.59
8.2.20.0030.00617.71
8.2.10.0050.00218.02
8.2.00.0000.00718.02
8.1.280.0070.01425.92
8.1.270.0100.01023.71
8.1.260.0000.00828.09
8.1.250.0070.00028.09
8.1.240.0060.00319.13
8.1.230.0060.00622.11
8.1.220.0040.00417.74
8.1.210.0070.00318.77
8.1.200.0080.00017.23
8.1.190.0030.00517.10
8.1.180.0030.00518.10
8.1.170.0050.00318.65
8.1.160.0040.00421.98
8.1.150.0000.00718.74
8.1.140.0000.00819.42
8.1.130.0050.00217.60
8.1.120.0040.00417.39
8.1.110.0080.00017.36
8.1.100.0050.00617.31
8.1.90.0000.00717.27
8.1.80.0040.00417.18
8.1.70.0000.00717.30
8.1.60.0030.00517.47
8.1.50.0090.00017.45
8.1.40.0040.00417.43
8.1.30.0000.00817.59
8.1.20.0040.00417.45
8.1.10.0000.00717.57
8.1.00.0050.00317.48
8.0.300.0070.00019.77
8.0.290.0030.00516.75
8.0.280.0000.00718.49
8.0.270.0070.00017.18
8.0.260.0040.00417.14
8.0.250.0000.00717.00
8.0.240.0030.00316.98
8.0.230.0030.00516.94
8.0.220.0000.00816.91
8.0.210.0000.00816.86
8.0.200.0030.00516.97
8.0.190.0000.00816.87
8.0.180.0050.00316.85
8.0.170.0000.00816.85
8.0.160.0000.00716.99
8.0.150.0070.00016.81
8.0.140.0080.00016.89
8.0.130.0050.00013.41
8.0.120.0000.00916.81
8.0.110.0050.00216.89
8.0.100.0040.00416.71
8.0.90.0040.00416.91
8.0.80.0150.00016.89
8.0.70.0040.00416.81
8.0.60.0020.00516.73
8.0.50.0000.00816.86
8.0.30.0100.00616.94
8.0.20.0080.01417.40
8.0.10.0000.00816.80
8.0.00.0030.01516.81
7.4.330.0000.00516.69
7.4.320.0030.00316.34
7.4.300.0000.00616.36
7.4.290.0030.00316.45
7.4.280.0030.00616.37
7.4.270.0070.00016.39
7.4.260.0040.00416.51
7.4.250.0040.00416.46
7.4.240.0050.00216.51
7.4.230.0070.00016.44
7.4.220.0060.01216.37
7.4.210.0040.01116.56
7.4.200.0070.00016.54
7.4.160.0120.00416.74
7.4.150.0000.01817.40
7.4.140.0100.00817.86
7.4.130.0140.00716.60
7.4.120.0130.00416.54
7.4.110.0110.00716.50
7.4.100.0140.00716.68
7.4.90.0100.00716.60
7.4.80.0140.00619.39
7.4.70.0080.00816.51
7.4.60.0060.01016.64
7.4.50.0100.00316.46
7.4.40.0110.01116.43
7.4.30.0160.00316.36
7.4.00.0110.00714.99
7.3.330.0030.00313.39
7.3.320.0000.00513.20
7.3.310.0000.00716.40
7.3.300.0030.00316.23
7.3.290.0110.00716.29
7.3.280.0110.01016.38
7.3.270.0090.00917.40
7.3.260.0030.02116.23
7.3.250.0090.01116.36
7.3.240.0100.00816.45
7.3.230.0090.01216.39
7.3.210.0030.01316.44
7.3.200.0060.01016.25
7.3.190.0130.00716.60
7.3.180.0090.01016.43
7.3.170.0170.00616.40
7.3.160.0140.00316.32
7.3.120.0120.00314.94
7.3.110.0120.00814.87
7.3.100.0120.00614.91
7.3.90.0030.01314.94
7.3.80.0060.00914.83
7.3.70.0040.01114.60
7.3.60.0090.00614.87
7.3.50.0000.01414.75
7.3.40.0030.00914.91
7.3.30.0100.00314.64
7.3.20.0040.00816.73
7.3.10.0000.01416.60
7.3.00.0060.00916.32
7.2.330.0140.00416.52
7.2.320.0100.00716.57
7.2.310.0120.00616.59
7.2.300.0120.00616.52
7.2.290.0090.00916.50
7.2.250.0070.01115.09
7.2.240.0070.01114.90
7.2.230.0100.00315.14
7.2.220.0040.00814.88
7.2.210.0040.00714.98
7.2.200.0060.00314.95
7.2.190.0040.00414.96
7.2.180.0070.00714.99
7.2.170.0060.01014.98
7.2.160.0000.01214.73
7.2.150.0000.01516.89
7.2.140.0090.00616.74
7.2.130.0000.01616.57
7.2.120.0060.00916.71
7.2.110.0080.00816.73
7.2.100.0000.01416.91
7.2.90.0040.00416.52
7.2.80.0060.00616.48
7.2.70.0000.01516.78
7.2.60.0040.01116.80
7.2.50.0040.00816.89
7.2.40.0070.01116.89
7.2.30.0050.00516.63
7.2.20.0090.00616.74
7.2.10.0060.00616.94
7.2.00.0050.01018.13
7.1.330.0050.01315.59
7.1.320.0040.00815.84
7.1.310.0000.01015.91
7.1.300.0120.00015.76
7.1.290.0060.00615.41
7.1.280.0000.01115.76
7.1.270.0030.00715.57
7.1.260.0060.00915.68
7.1.250.0080.00315.48
7.1.240.0060.00815.63
7.1.230.0030.00915.52
7.1.220.0100.00615.50
7.1.210.0000.01215.70
7.1.200.0010.01115.61
7.1.190.0080.00615.74
7.1.180.0120.00315.75
7.1.170.0040.00415.45
7.1.160.0000.01015.82
7.1.150.0110.00315.64
7.1.140.0070.00415.71
7.1.130.0080.00415.70
7.1.120.0030.01015.63
7.1.110.0040.01115.83
7.1.100.0050.00816.87
7.1.90.0140.00015.86
7.1.80.0000.01215.68
7.1.70.0080.00816.51
7.1.60.0070.00717.60
7.1.50.0040.01016.07
7.1.40.0030.01015.82
7.1.30.0110.00715.71
7.1.20.0000.01115.64
7.1.10.0000.01415.56
7.1.00.0050.04219.03
7.0.330.0090.00315.13
7.0.320.0040.01215.06
7.0.310.0070.00315.13
7.0.300.0100.00015.39
7.0.290.0130.00315.41
7.0.280.0030.01015.30
7.0.270.0000.01115.36
7.0.260.0040.01115.29
7.0.250.0090.00015.33
7.0.240.0030.01015.44
7.0.230.0060.00615.49
7.0.220.0070.00315.46
7.0.210.0090.00315.34
7.0.200.0010.00716.09
7.0.190.0070.01015.24
7.0.180.0140.00315.49
7.0.170.0090.00615.29
7.0.160.0110.00415.29
7.0.150.0040.01015.44
7.0.140.0030.01315.41
7.0.130.0070.00715.08
7.0.120.0040.01115.23
7.0.110.0050.00515.39
7.0.100.0040.01215.38
7.0.90.0060.00615.44
7.0.80.0070.00715.34
7.0.70.0070.01015.38
7.0.60.0110.04217.63
7.0.50.0030.04216.69
7.0.40.0050.02716.85
7.0.30.0290.04216.83
7.0.20.0190.04316.91
7.0.10.0020.02716.73
7.0.00.0080.03116.84
5.6.400.0030.00914.16
5.6.390.0060.00914.30
5.6.380.0000.00814.36
5.6.370.0090.00314.28
5.6.360.0030.01114.07
5.6.350.0050.00514.46
5.6.340.0040.00814.06
5.6.330.0030.00914.13
5.6.320.0060.00614.10
5.6.310.0040.01114.11
5.6.300.0040.01114.31
5.6.290.0120.00314.45
5.6.280.0040.03317.69
5.6.270.0030.00914.20
5.6.260.0060.00614.33
5.6.250.0070.00714.30
5.6.240.0000.01214.16
5.6.230.0090.00914.19
5.6.220.0070.00414.38
5.6.210.0070.04317.46
5.6.200.0050.04416.09
5.6.190.0020.03217.45
5.6.180.0290.03817.27
5.6.170.0180.03617.49
5.6.160.0110.04217.36
5.6.150.0070.05016.21
5.6.140.0030.02616.08
5.6.130.0080.04216.27
5.6.120.0070.03817.85
5.6.110.0030.04617.65
5.6.100.0120.03317.65
5.6.90.0020.05017.53
5.6.80.0130.02717.27
5.6.70.0000.01014.23
5.6.60.0030.01013.98
5.6.50.0040.01114.33
5.6.40.0060.00814.07
5.6.30.0110.00414.09
5.6.20.0030.00714.13
5.6.10.0070.00714.35
5.6.00.0040.00914.11
5.5.380.0030.01414.27
5.5.370.0100.00713.82
5.5.360.0000.01414.29
5.5.350.0120.03717.28
5.5.340.0020.02716.19
5.5.330.0100.04317.31
5.5.320.0030.02717.25
5.5.310.0030.03017.19
5.5.300.0080.04116.02
5.5.290.0080.04016.15
5.5.280.0130.04017.34
5.5.270.0050.02317.62
5.5.260.0080.04517.59
5.5.250.0070.04217.40
5.5.240.0090.02217.09
5.5.230.0030.00714.07
5.5.220.0030.01014.01
5.5.210.0040.01114.36
5.5.200.0060.00914.00
5.5.190.0030.00814.09
5.5.180.0110.00413.74
5.5.170.0090.00613.68
5.5.160.0040.00414.22
5.5.150.0110.00013.88
5.5.140.0030.01013.89
5.5.130.0030.01014.21
5.5.120.0040.00814.13
5.5.110.0000.00814.13
5.5.100.0060.00313.97
5.5.90.0040.00814.11
5.5.80.0050.00314.07
5.5.70.0000.01113.89
5.5.60.0120.00314.10
5.5.50.0030.01214.14
5.5.40.0100.00313.88
5.5.30.0030.00913.92
5.5.20.0110.00013.59
5.5.10.0040.00713.90
5.5.00.0080.00013.83

preferences:
63.67 ms | 400 KiB | 5 Q