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) { $output = $this->encrypt($input); return $output; } public function decryptData($input) { $output = $this->decrypt($input); return $output; } protected function decrypt($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; } protected 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; return $output; } } $test = new Encryption(); $encrypted = $test->encryptData("Vicky"); echo $encrypted."\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.60.0140.00716.88
8.3.50.0090.00617.89
8.3.40.0120.00318.79
8.3.30.0090.00918.67
8.3.20.0050.00320.38
8.3.10.0140.00023.70
8.3.00.0050.00319.38
8.2.180.0110.01116.60
8.2.170.0130.00322.96
8.2.160.0130.00720.35
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00020.47
8.2.120.0070.00026.35
8.2.110.0040.00721.11
8.2.100.0070.00317.97
8.2.90.0040.00417.88
8.2.80.0000.01018.59
8.2.70.0060.00317.75
8.2.60.0050.00317.50
8.2.50.0040.00417.80
8.2.40.0000.00817.79
8.2.30.0070.00020.56
8.2.20.0060.00317.66
8.2.10.0070.00018.05
8.2.00.0030.00618.09
8.1.270.0110.00323.85
8.1.260.0000.00728.09
8.1.250.0040.01128.09
8.1.240.0070.00319.46
8.1.230.0030.00721.04
8.1.220.0050.00318.36
8.1.210.0040.00418.77
8.1.200.0050.00317.36
8.1.190.0090.00016.98
8.1.180.0040.00418.10
8.1.170.0040.00417.62
8.1.160.0050.00321.94
8.1.150.0050.00318.80
8.1.140.0090.00019.50
8.1.130.0030.00317.61
8.1.120.0040.00417.29
8.1.110.0000.00717.35
8.1.100.0000.00717.36
8.1.90.0000.00817.33
8.1.80.0080.00017.27
8.1.70.0000.00817.31
8.1.60.0090.00017.41
8.1.50.0040.00417.38
8.1.40.0030.00517.49
8.1.30.0000.00917.61
8.1.20.0070.00017.57
8.1.10.0040.00417.47
8.1.00.0020.00517.51
8.0.300.0040.00418.77
8.0.290.0090.00016.88
8.0.280.0060.00318.38
8.0.270.0000.00717.29
8.0.260.0000.00717.13
8.0.250.0030.00317.04
8.0.240.0000.00617.04
8.0.230.0040.00416.97
8.0.220.0030.00316.90
8.0.210.0040.00416.88
8.0.200.0030.00316.86
8.0.190.0040.00416.89
8.0.180.0000.00816.91
8.0.170.0000.00716.94
8.0.160.0050.00317.05
8.0.150.0020.00516.77
8.0.140.0000.00816.82
8.0.130.0000.00513.45
8.0.120.0040.00416.94
8.0.110.0000.00816.93
8.0.100.0040.00416.74
8.0.90.0040.00416.94
8.0.80.0100.01016.98
8.0.70.0000.00716.86
8.0.60.0000.00816.73
8.0.50.0070.00016.95
8.0.30.0130.00617.34
8.0.20.0080.01117.40
8.0.10.0040.00416.96
8.0.00.0080.00916.73
7.4.330.0050.00016.70
7.4.320.0030.00316.47
7.4.300.0030.00316.48
7.4.290.0030.00316.57
7.4.280.0060.00316.47
7.4.270.0070.00016.59
7.4.260.0030.00616.61
7.4.250.0030.00316.44
7.4.240.0030.00516.53
7.4.230.0000.00716.44
7.4.220.0090.00916.49
7.4.210.0070.00716.48
7.4.200.0030.00316.61
7.4.160.0060.00916.41
7.4.150.0110.00717.40
7.4.140.0160.00817.86
7.4.130.0100.00916.59
7.4.120.0100.00616.58
7.4.110.0110.00716.76
7.4.100.0090.00916.48
7.4.90.0040.01616.62
7.4.80.0090.00919.39
7.4.70.0070.01016.57
7.4.60.0070.01016.64
7.4.50.0070.01016.61
7.4.40.0070.01016.23
7.4.30.0000.01716.38
7.4.10.0110.00814.74
7.4.00.0090.00914.85
7.3.330.0000.00613.49
7.3.320.0030.00313.34
7.3.310.0030.00416.29
7.3.300.0050.00216.40
7.3.290.0080.00816.38
7.3.280.0090.01016.40
7.3.270.0170.00717.40
7.3.260.0090.00916.34
7.3.250.0090.01016.36
7.3.240.0120.00616.28
7.3.230.0040.01516.40
7.3.210.0030.01416.47
7.3.200.0090.00616.64
7.3.190.0030.01516.50
7.3.180.0100.01016.55
7.3.170.0080.00916.68
7.3.160.0160.00816.38
7.3.130.0070.01114.93
7.3.120.0090.00615.06
7.3.110.0070.01114.97
7.3.100.0090.00314.48
7.3.90.0070.00714.75
7.3.80.0030.01014.88
7.3.70.0030.01214.79
7.3.60.0100.00714.71
7.3.50.0070.01014.68
7.3.40.0060.00914.87
7.3.30.0070.00714.84
7.3.20.0090.00616.43
7.3.10.0090.00716.25
7.3.00.0090.00216.52
7.2.330.0070.01016.74
7.2.320.0030.01416.67
7.2.310.0140.00716.61
7.2.300.0140.00316.34
7.2.290.0100.00716.32
7.2.260.0090.00914.68
7.2.250.0060.01214.92
7.2.240.0100.00615.04
7.2.230.0090.00614.54
7.2.220.0070.01014.89
7.2.210.0070.00714.95
7.2.200.0140.00014.99
7.2.190.0110.00414.57
7.2.180.0120.00014.61
7.2.170.0060.00914.68
7.2.160.0090.00914.98
7.2.150.0100.00616.60
7.2.140.0080.00416.83
7.2.130.0070.00716.48
7.2.120.0030.01016.66
7.2.110.0100.00616.63
7.2.100.0090.00516.68
7.2.90.0040.00916.57
7.2.80.0120.00716.49
7.2.70.0080.01016.69
7.2.60.0060.01116.62
7.2.50.0040.00816.56
7.2.40.0110.00516.58
7.2.30.0070.01116.65
7.2.20.0060.01216.47
7.2.10.0060.01116.69
7.2.00.0080.00917.22
7.1.330.0000.01415.89
7.1.320.0120.00315.55
7.1.310.0080.00615.80
7.1.300.0120.00015.69
7.1.290.0060.00615.58
7.1.280.0030.01015.73
7.1.270.0040.01115.74
7.1.260.0000.01015.50
7.1.250.0020.00915.56
7.1.240.0000.01515.70
7.1.230.0090.00315.70
7.1.220.0030.01115.70
7.1.210.0080.00415.62
7.1.200.0110.00415.58
7.1.190.0030.01315.52
7.1.180.0130.00015.70
7.1.170.0120.00615.75
7.1.160.0090.00615.77
7.1.150.0080.00315.79
7.1.140.0050.00515.59
7.1.130.0120.00015.72
7.1.120.0100.00615.48
7.1.110.0030.01015.71
7.1.100.0030.00716.78
7.1.90.0100.00315.61
7.1.80.0080.00315.77
7.1.70.0040.00716.23
7.1.60.0050.01417.49
7.1.50.0030.01216.18
7.1.40.0070.00715.71
7.1.30.0000.01215.40
7.1.20.0070.00715.75
7.1.10.0030.00815.48
7.1.00.0050.03919.05
7.0.330.0060.00615.33
7.0.320.0000.01015.26
7.0.310.0040.01215.24
7.0.300.0030.01315.35
7.0.290.0060.00315.47
7.0.280.0060.00615.04
7.0.270.0000.01215.46
7.0.260.0030.01015.14
7.0.250.0060.00915.26
7.0.240.0060.00615.18
7.0.230.0040.01115.11
7.0.220.0030.00814.97
7.0.210.0100.00015.31
7.0.200.0030.00815.95
7.0.190.0130.00015.18
7.0.180.0030.00915.16
7.0.170.0040.00915.42
7.0.160.0070.00715.27
7.0.150.0070.00715.32
7.0.140.0060.00615.34
7.0.130.0030.00615.32
7.0.120.0070.00715.27
7.0.110.0140.00015.45
7.0.100.0080.00015.37
7.0.90.0000.00815.36
7.0.80.0100.00315.36
7.0.70.0070.00715.27
7.0.60.0060.02217.63
7.0.50.0080.02816.71
7.0.40.0070.04716.87
7.0.30.0230.04216.89
7.0.20.0190.04416.69
7.0.10.0050.02816.73
7.0.00.0100.03816.81
5.6.400.0060.00314.48
5.6.390.0050.00314.23
5.6.380.0060.00914.36
5.6.370.0100.00714.29
5.6.360.0040.01214.26
5.6.350.0100.00714.48
5.6.340.0030.01014.40
5.6.330.0060.01013.91
5.6.320.0050.00714.56
5.6.310.0030.01014.13
5.6.300.0040.00714.14
5.6.290.0030.00614.50
5.6.280.0020.02817.66
5.6.270.0090.00614.41
5.6.260.0080.00814.27
5.6.250.0000.01614.07
5.6.240.0030.00614.28
5.6.230.0100.00314.14
5.6.220.0000.01014.38
5.6.210.0100.04017.30
5.6.200.0080.03516.23
5.6.190.0100.04217.30
5.6.180.0180.04317.35
5.6.170.0220.04017.18
5.6.160.0210.02917.31
5.6.150.0050.04216.15
5.6.140.0030.03616.26
5.6.130.0070.04116.30
5.6.120.0080.04317.71
5.6.110.0100.04517.66
5.6.100.0100.04117.60
5.6.90.0050.04617.58
5.6.80.0090.04417.33
5.6.70.0040.00814.11
5.6.60.0040.00814.05
5.6.50.0030.00614.09
5.6.40.0040.01113.97
5.6.30.0030.00914.47
5.6.20.0060.00314.04
5.6.10.0060.00614.14
5.6.00.0080.00514.10
5.5.380.0120.00013.87
5.5.370.0000.01514.12
5.5.360.0110.00014.07
5.5.350.0130.04217.23
5.5.340.0120.03816.04
5.5.330.0050.03717.15
5.5.320.0030.02817.37
5.5.310.0100.02817.11
5.5.300.0100.04316.18
5.5.290.0050.02816.14
5.5.280.0140.01717.70
5.5.270.0060.03617.38
5.5.260.0100.04517.52
5.5.250.0080.03917.27
5.5.240.0150.04217.16
5.5.230.0040.01114.20
5.5.220.0030.00614.07
5.5.210.0090.00614.10
5.5.200.0000.01014.19
5.5.190.0060.00314.04
5.5.180.0040.00814.16
5.5.170.0030.00514.19
5.5.160.0070.00414.23
5.5.150.0070.00713.88
5.5.140.0030.00913.86
5.5.130.0060.00614.21
5.5.120.0000.01014.24
5.5.110.0030.01314.30
5.5.100.0070.00714.13
5.5.90.0080.00414.07
5.5.80.0100.00014.15
5.5.70.0000.01214.18
5.5.60.0070.00714.13
5.5.50.0100.00713.89
5.5.40.0000.01614.09
5.5.30.0000.01414.30
5.5.20.0080.00414.10
5.5.10.0100.00014.37
5.5.00.0050.00514.06

preferences:
89.29 ms | 400 KiB | 5 Q