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($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 $test->encryptData("Narendra")."\n"; 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.70.0120.00318.55
8.3.60.0140.00718.38
8.3.50.0090.00922.05
8.3.40.0070.00718.88
8.3.30.0090.00618.70
8.3.20.0040.00420.38
8.3.10.0050.00323.26
8.3.00.0080.00019.50
8.2.190.0090.00618.54
8.2.180.0140.00717.00
8.2.170.0000.01422.96
8.2.160.0100.00320.16
8.2.150.0060.00324.18
8.2.140.0060.00324.66
8.2.130.0030.00620.53
8.2.120.0070.00026.35
8.2.110.0060.00319.31
8.2.100.0080.00417.84
8.2.90.0000.00819.23
8.2.80.0050.00317.97
8.2.70.0050.00317.60
8.2.60.0000.00817.50
8.2.50.0060.00317.50
8.2.40.0030.00519.66
8.2.30.0040.00420.63
8.2.20.0060.00317.65
8.2.10.0040.00418.02
8.2.00.0000.00817.93
8.1.280.0090.00925.92
8.1.270.0090.00022.25
8.1.260.0030.00528.09
8.1.250.0040.00428.09
8.1.240.0090.00022.20
8.1.230.0120.00018.96
8.1.220.0060.00317.74
8.1.210.0080.00018.77
8.1.200.0030.00617.25
8.1.190.0060.00317.23
8.1.180.0030.00618.10
8.1.170.0050.00317.62
8.1.160.0000.00721.99
8.1.150.0050.00218.79
8.1.140.0050.00319.49
8.1.130.0030.00317.66
8.1.120.0070.00417.23
8.1.110.0050.00317.32
8.1.100.0030.00517.26
8.1.90.0040.00417.35
8.1.80.0050.00217.24
8.1.70.0030.00517.28
8.1.60.0070.00317.46
8.1.50.0090.00017.39
8.1.40.0030.00617.48
8.1.30.0030.00617.58
8.1.20.0000.00717.48
8.1.10.0040.00417.52
8.1.00.0000.00817.43
8.0.300.0000.00918.77
8.0.290.0070.00016.75
8.0.280.0040.00418.39
8.0.270.0000.00717.07
8.0.260.0000.00617.22
8.0.250.0000.00716.99
8.0.240.0030.00316.96
8.0.230.0030.00317.02
8.0.220.0000.00816.93
8.0.210.0000.00716.91
8.0.200.0040.00417.02
8.0.190.0070.00017.01
8.0.180.0000.00716.96
8.0.170.0050.00316.93
8.0.160.0000.00716.90
8.0.150.0050.00316.83
8.0.140.0060.00316.88
8.0.130.0030.00313.29
8.0.120.0080.00016.93
8.0.110.0070.00016.88
8.0.100.0070.00016.73
8.0.90.0050.00216.97
8.0.80.0060.00916.85
8.0.70.0040.00416.75
8.0.60.0040.00416.72
8.0.50.0000.00816.98
8.0.30.0120.00617.11
8.0.20.0100.00917.40
8.0.10.0000.00716.77
8.0.00.0110.00616.80
7.4.330.0000.00516.84
7.4.320.0030.00316.42
7.4.300.0060.00016.57
7.4.290.0070.00016.37
7.4.280.0030.00616.57
7.4.270.0000.00716.46
7.4.260.0040.00416.53
7.4.250.0000.00716.35
7.4.240.0020.00616.46
7.4.230.0030.00316.31
7.4.220.0110.01116.64
7.4.210.0070.00716.34
7.4.200.0070.00016.55
7.4.160.0090.00616.67
7.4.150.0080.01117.40
7.4.140.0120.01217.86
7.4.130.0090.00816.55
7.4.120.0120.00916.61
7.4.110.0120.00616.73
7.4.100.0140.00916.36
7.4.90.0150.00316.39
7.4.80.0090.00919.39
7.4.70.0150.00416.40
7.4.60.0030.01416.59
7.4.50.0040.01116.61
7.4.40.0040.01416.32
7.4.30.0070.01116.36
7.4.10.0070.01114.89
7.4.00.0130.00515.02
7.3.330.0050.00013.23
7.3.320.0020.00213.39
7.3.310.0000.00816.28
7.3.300.0000.00716.42
7.3.290.0090.00516.36
7.3.280.0070.01116.36
7.3.270.0140.00317.40
7.3.260.0070.01516.28
7.3.250.0060.01316.43
7.3.240.0090.00716.29
7.3.230.0100.00716.39
7.3.210.0030.01316.44
7.3.200.0040.01216.26
7.3.190.0120.00316.23
7.3.180.0100.01016.61
7.3.170.0140.00816.65
7.3.160.0160.00616.23
7.3.130.0070.01414.81
7.3.120.0100.01014.55
7.3.110.0070.01314.75
7.3.100.0060.00614.73
7.3.90.0060.00914.45
7.3.80.0090.00914.61
7.3.70.0060.00614.75
7.3.60.0040.01114.86
7.3.50.0030.01014.82
7.3.40.0050.00514.49
7.3.30.0130.00314.84
7.3.20.0000.01316.39
7.3.10.0050.00716.46
7.3.00.0070.00416.46
7.2.330.0030.01416.58
7.2.320.0090.00916.59
7.2.310.0160.00416.48
7.2.300.0100.01116.41
7.2.290.0100.00716.41
7.2.260.0040.01515.07
7.2.250.0070.01015.07
7.2.240.0060.00915.07
7.2.230.0090.00914.84
7.2.220.0060.00615.20
7.2.210.0060.00614.44
7.2.200.0080.00414.86
7.2.190.0150.00414.91
7.2.180.0030.00614.63
7.2.170.0070.00714.84
7.2.160.0040.00814.98
7.2.150.0030.01316.81
7.2.140.0060.00916.90
7.2.130.0060.00816.60
7.2.120.0060.00916.83
7.2.110.0100.00316.81
7.2.100.0060.00916.61
7.2.90.0080.00516.60
7.2.80.0060.00616.76
7.2.70.0040.00916.79
7.2.60.0040.01116.73
7.2.50.0100.00216.64
7.2.40.0080.00516.89
7.2.30.0020.01216.87
7.2.20.0020.01016.84
7.2.10.0040.00916.78
7.2.00.0060.00917.67
7.1.330.0060.01015.48
7.1.320.0080.00815.73
7.1.310.0090.00315.93
7.1.300.0120.00415.82
7.1.290.0060.00315.69
7.1.280.0030.00915.72
7.1.270.0070.00715.73
7.1.260.0060.00615.78
7.1.250.0080.00315.71
7.1.240.0060.00915.73
7.1.230.0090.00315.56
7.1.220.0080.00415.82
7.1.210.0000.01115.49
7.1.200.0060.00615.73
7.1.190.0030.00915.30
7.1.180.0070.00715.43
7.1.170.0090.00015.68
7.1.160.0110.00415.66
7.1.150.0100.00315.45
7.1.140.0060.00915.74
7.1.130.0100.00015.65
7.1.120.0150.00015.72
7.1.110.0060.00815.74
7.1.100.0030.01017.14
7.1.90.0060.00615.30
7.1.80.0070.00315.74
7.1.70.0020.00916.13
7.1.60.0100.00817.63
7.1.50.0040.01016.34
7.1.40.0030.00915.42
7.1.30.0060.00615.66
7.1.20.0030.01015.65
7.1.10.0060.00615.77
7.1.00.0040.04219.15
7.0.330.0070.00415.29
7.0.320.0100.00615.35
7.0.310.0070.00315.22
7.0.300.0040.00815.28
7.0.290.0000.01115.29
7.0.280.0030.00715.24
7.0.270.0030.01215.43
7.0.260.0030.00715.13
7.0.250.0110.00415.27
7.0.240.0000.01115.13
7.0.230.0040.00815.52
7.0.220.0070.00714.98
7.0.210.0000.01315.25
7.0.200.0030.00615.88
7.0.190.0000.01015.44
7.0.180.0030.00815.45
7.0.170.0030.00715.13
7.0.160.0050.00515.01
7.0.150.0030.00615.09
7.0.140.0070.00315.29
7.0.130.0060.01015.29
7.0.120.0060.00915.39
7.0.110.0070.00715.39
7.0.100.0050.00515.37
7.0.90.0060.00915.27
7.0.80.0030.00615.14
7.0.70.0030.01015.14
7.0.60.0070.04517.66
7.0.50.0100.03716.62
7.0.40.0120.02616.70
7.0.30.0150.02516.84
7.0.20.0220.04016.72
7.0.10.0090.04116.74
7.0.00.0050.04416.81
5.6.400.0100.00314.25
5.6.390.0000.01414.15
5.6.380.0030.00614.08
5.6.370.0030.00714.45
5.6.360.0030.00614.55
5.6.350.0000.01014.42
5.6.340.0070.00714.61
5.6.330.0060.00814.38
5.6.320.0110.00414.28
5.6.310.0030.00614.53
5.6.300.0030.00714.06
5.6.290.0030.00714.28
5.6.280.0080.03617.62
5.6.270.0090.00614.19
5.6.260.0030.00614.59
5.6.250.0030.01014.32
5.6.240.0060.00314.34
5.6.230.0030.01014.30
5.6.220.0090.00614.50
5.6.210.0050.04217.39
5.6.200.0070.02816.35
5.6.190.0030.02817.47
5.6.180.0360.03317.44
5.6.170.0150.03517.38
5.6.160.0030.04917.53
5.6.150.0030.04616.10
5.6.140.0020.02516.26
5.6.130.0100.02016.18
5.6.120.0110.03817.64
5.6.110.0050.02617.55
5.6.100.0100.04317.77
5.6.90.0120.04217.75
5.6.80.0160.01117.37
5.6.70.0030.01013.92
5.6.60.0070.00314.10
5.6.50.0060.00914.07
5.6.40.0080.00314.01
5.6.30.0040.00813.92
5.6.20.0040.00813.84
5.6.10.0040.01114.12
5.6.00.0070.00314.27
5.5.380.0060.00614.14
5.5.370.0030.01114.20
5.5.360.0060.00613.81
5.5.350.0180.04017.34
5.5.340.0020.02716.13
5.5.330.0030.02517.22
5.5.320.0050.04417.27
5.5.310.0090.02917.19
5.5.300.0040.02716.00
5.5.290.0040.02515.84
5.5.280.0070.03317.61
5.5.270.0040.04717.48
5.5.260.0020.04217.38
5.5.250.0030.04617.27
5.5.240.0170.04017.17
5.5.230.0090.00313.80
5.5.220.0070.00313.82
5.5.210.0130.00013.85
5.5.200.0030.00713.90
5.5.190.0060.00613.59
5.5.180.0060.00913.79
5.5.170.0030.01014.04
5.5.160.0110.00313.55
5.5.150.0070.01113.98
5.5.140.0080.00813.78
5.5.130.0080.01113.81
5.5.120.0040.00414.17
5.5.110.0070.00413.50
5.5.100.0100.00313.87
5.5.90.0000.01314.14
5.5.80.0110.00413.90
5.5.70.0070.01014.32
5.5.60.0030.00914.05
5.5.50.0070.00714.24
5.5.40.0030.01014.29
5.5.30.0070.01113.78
5.5.20.0070.00714.11
5.5.10.0000.01313.79
5.5.00.0040.01413.85

preferences:
38.03 ms | 401 KiB | 5 Q