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; } 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(); $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.0180.00716.75
8.3.50.0120.00318.07
8.3.40.0170.00318.60
8.3.30.0040.01118.80
8.3.20.0030.00520.16
8.3.10.0060.00323.65
8.3.00.0060.00319.38
8.2.180.0040.01516.63
8.2.170.0090.00622.96
8.2.160.0110.00720.36
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00320.58
8.2.120.0040.00426.35
8.2.110.0070.00321.12
8.2.100.0080.00317.91
8.2.90.0030.00519.08
8.2.80.0000.00917.97
8.2.70.0000.01117.63
8.2.60.0060.00317.91
8.2.50.0080.00018.07
8.2.40.0040.00421.21
8.2.30.0000.00820.59
8.2.20.0000.01017.73
8.2.10.0070.00018.04
8.2.00.0000.00918.03
8.1.280.0110.00425.92
8.1.270.0000.00823.88
8.1.260.0000.00828.09
8.1.250.0030.00528.09
8.1.240.0090.00022.20
8.1.230.0050.00518.98
8.1.220.0060.00317.74
8.1.210.0060.00318.77
8.1.200.0030.00617.38
8.1.190.0000.00817.57
8.1.180.0000.00818.10
8.1.170.0090.00018.46
8.1.160.0000.00721.90
8.1.150.0030.00518.69
8.1.140.0040.00419.41
8.1.130.0070.00017.68
8.1.120.0040.00417.30
8.1.110.0070.00017.29
8.1.100.0040.00417.38
8.1.90.0000.00717.23
8.1.80.0000.00717.41
8.1.70.0070.00017.32
8.1.60.0060.00317.56
8.1.50.0080.00017.41
8.1.40.0040.00417.52
8.1.30.0040.00417.62
8.1.20.0040.00417.50
8.1.10.0000.00917.59
8.1.00.0040.00417.50
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0000.00718.48
8.0.270.0040.00417.19
8.0.260.0040.00417.25
8.0.250.0030.00316.98
8.0.240.0000.00716.99
8.0.230.0000.00717.05
8.0.220.0000.00816.96
8.0.210.0060.00316.95
8.0.200.0030.00316.93
8.0.190.0030.00516.90
8.0.180.0060.00316.95
8.0.170.0070.00016.96
8.0.160.0040.00417.02
8.0.150.0000.00716.91
8.0.140.0040.00416.91
8.0.130.0000.00513.34
8.0.120.0030.00516.95
8.0.110.0000.00816.87
8.0.100.0030.00516.98
8.0.90.0050.00316.83
8.0.80.0090.00616.99
8.0.70.0040.00416.91
8.0.60.0040.00416.96
8.0.50.0080.00016.84
8.0.30.0100.01016.93
8.0.20.0090.00917.40
8.0.10.0040.00416.89
8.0.00.0130.00416.85
7.4.330.0020.00216.70
7.4.320.0030.00316.51
7.4.300.0030.00316.60
7.4.290.0030.00416.59
7.4.280.0090.00016.59
7.4.270.0000.00716.63
7.4.260.0000.00816.60
7.4.250.0000.00716.47
7.4.240.0020.00516.44
7.4.230.0000.00716.43
7.4.220.0060.01316.67
7.4.210.0070.01316.54
7.4.200.0040.00416.62
7.4.160.0090.00616.65
7.4.150.0100.00917.40
7.4.140.0090.01017.86
7.4.130.0070.01016.47
7.4.120.0040.01316.48
7.4.110.0040.01416.54
7.4.100.0140.00416.43
7.4.90.0110.00516.54
7.4.80.0090.00919.39
7.4.70.0190.00316.52
7.4.60.0100.01316.58
7.4.50.0060.01016.66
7.4.40.0030.01416.55
7.4.30.0090.00916.41
7.4.10.0100.00714.93
7.4.00.0080.00614.96
7.3.330.0030.00313.40
7.3.320.0000.00613.38
7.3.310.0000.00816.39
7.3.300.0070.00016.29
7.3.290.0060.01116.32
7.3.280.0070.01016.34
7.3.270.0110.00717.40
7.3.260.0090.00916.67
7.3.250.0120.00516.35
7.3.240.0110.00916.41
7.3.230.0170.00016.39
7.3.210.0090.00916.28
7.3.200.0140.00316.56
7.3.190.0200.00316.39
7.3.180.0130.01216.27
7.3.170.0150.00316.56
7.3.160.0150.00616.26
7.3.130.0090.00914.72
7.3.120.0030.01314.73
7.3.110.0060.00914.88
7.3.100.0030.01014.40
7.3.90.0120.00014.63
7.3.80.0140.00714.87
7.3.70.0070.00714.84
7.3.60.0130.00014.92
7.3.50.0090.00014.88
7.3.40.0030.01014.71
7.3.30.0000.01814.63
7.3.20.0040.00716.73
7.3.10.0030.00916.58
7.3.00.0060.00416.43
7.2.330.0100.00716.53
7.2.320.0110.00616.23
7.2.310.0110.00916.68
7.2.300.0070.01416.73
7.2.290.0100.00616.29
7.2.260.0100.00714.63
7.2.250.0110.00615.11
7.2.240.0040.01115.15
7.2.230.0040.01514.91
7.2.220.0040.01814.95
7.2.210.0070.00714.75
7.2.200.0000.01614.86
7.2.190.0030.01014.92
7.2.180.0000.01314.94
7.2.170.0060.00614.75
7.2.160.0070.01114.94
7.2.150.0120.00016.80
7.2.140.0030.01016.64
7.2.130.0020.01216.67
7.2.120.0050.00516.77
7.2.110.0050.00816.72
7.2.100.0060.00816.69
7.2.90.0060.01016.69
7.2.80.0040.01116.79
7.2.70.0050.00616.69
7.2.60.0070.00516.81
7.2.50.0050.00916.83
7.2.40.0070.00916.75
7.2.30.0020.01216.79
7.2.20.0020.00916.78
7.2.10.0050.00616.71
7.2.00.0110.00417.41
7.1.330.0070.00715.64
7.1.320.0140.00015.76
7.1.310.0040.00415.78
7.1.300.0030.00915.82
7.1.290.0000.00815.80
7.1.280.0050.00515.69
7.1.270.0070.00715.70
7.1.260.0040.00415.49
7.1.250.0080.00515.71
7.1.240.0000.01215.75
7.1.230.0040.01115.63
7.1.220.0030.00915.81
7.1.210.0060.00615.68
7.1.200.0030.00915.74
7.1.190.0030.00915.48
7.1.180.0000.00915.78
7.1.170.0000.01015.72
7.1.160.0050.00315.59
7.1.150.0000.01415.52
7.1.140.0040.01115.55
7.1.130.0060.00615.59
7.1.120.0040.00815.66
7.1.110.0040.01115.48
7.1.100.0050.00916.94
7.1.90.0070.00715.63
7.1.80.0000.01215.73
7.1.70.0000.00916.25
7.1.60.0070.01217.47
7.1.50.0070.01116.27
7.1.40.0060.00315.63
7.1.30.0000.01015.63
7.1.20.0060.00615.73
7.1.10.0040.00715.78
7.1.00.0100.03819.01
7.0.330.0080.00015.35
7.0.320.0080.00315.27
7.0.310.0070.00315.34
7.0.300.0070.00315.08
7.0.290.0040.00415.39
7.0.280.0060.00615.03
7.0.270.0030.00715.06
7.0.260.0070.00715.32
7.0.250.0030.01015.12
7.0.240.0060.00815.24
7.0.230.0000.01315.25
7.0.220.0070.00715.36
7.0.210.0080.00315.38
7.0.200.0000.00916.01
7.0.190.0040.00715.32
7.0.180.0000.01115.36
7.0.170.0030.01015.07
7.0.160.0000.00815.34
7.0.150.0090.00015.32
7.0.140.0000.01115.19
7.0.130.0030.01415.44
7.0.120.0000.01415.34
7.0.110.0070.01015.04
7.0.100.0000.01415.06
7.0.90.0070.00715.32
7.0.80.0100.00315.34
7.0.70.0030.01315.31
7.0.60.0200.02217.47
7.0.50.0050.03716.49
7.0.40.0120.04016.64
7.0.30.0180.04216.70
7.0.20.0200.04316.74
7.0.10.0050.04116.77
7.0.00.0070.05016.84
5.6.400.0120.00314.31
5.6.390.0070.00713.83
5.6.380.0000.00814.52
5.6.370.0040.00814.46
5.6.360.0070.00714.17
5.6.350.0100.00714.06
5.6.340.0000.00814.29
5.6.330.0000.01314.26
5.6.320.0060.00614.44
5.6.310.0110.00314.14
5.6.300.0030.00614.06
5.6.290.0040.00814.48
5.6.280.0070.03117.75
5.6.270.0030.01014.54
5.6.260.0110.00414.04
5.6.250.0110.00313.95
5.6.240.0000.01614.04
5.6.230.0070.00714.46
5.6.220.0040.00814.18
5.6.210.0020.02617.47
5.6.200.0040.03816.13
5.6.190.0060.03317.36
5.6.180.0130.02617.22
5.6.170.0300.03717.34
5.6.160.0100.04217.18
5.6.150.0030.04216.22
5.6.140.0090.04016.11
5.6.130.0080.03016.20
5.6.120.0070.03717.45
5.6.110.0140.03817.63
5.6.100.0070.03017.67
5.6.90.0050.04517.59
5.6.80.0080.03817.36
5.6.70.0080.00014.34
5.6.60.0030.00914.13
5.6.50.0060.00314.16
5.6.40.0060.00714.38
5.6.30.0050.00314.06
5.6.20.0090.00914.21
5.6.10.0060.01014.42
5.6.00.0090.00314.04
5.5.380.0130.00014.23
5.5.370.0100.00314.16
5.5.360.0000.01314.10
5.5.350.0140.04117.17
5.5.340.0050.03915.98
5.5.330.0100.04317.37
5.5.320.0140.02517.12
5.5.310.0250.03517.21
5.5.300.0040.02115.91
5.5.290.0050.02716.20
5.5.280.0070.03817.37
5.5.270.0070.03517.42
5.5.260.0100.03417.54
5.5.250.0090.03517.44
5.5.240.0050.04017.19
5.5.230.0080.00413.92
5.5.220.0030.00914.13
5.5.210.0060.00614.12
5.5.200.0040.00414.18
5.5.190.0000.01314.22
5.5.180.0140.00313.96
5.5.170.0040.01214.27
5.5.160.0040.01414.18
5.5.150.0070.01014.08
5.5.140.0070.00714.01
5.5.130.0030.00613.88
5.5.120.0060.01013.87
5.5.110.0050.00313.88
5.5.100.0080.00514.21
5.5.90.0040.00414.22
5.5.80.0100.00314.11
5.5.70.0070.00714.04
5.5.60.0040.01114.04
5.5.50.0000.01113.98
5.5.40.0090.00614.00
5.5.30.0030.00914.09
5.5.20.0040.01113.59
5.5.10.0100.00714.04
5.5.00.0110.00313.87

preferences:
58.48 ms | 401 KiB | 5 Q