3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(1); ini_set('display_errors', 1); class Encryption { private $key; protected $iv_size; protected $iv; public function __construct(){ $this->key = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3"); $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) { $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; } 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; # 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.0070.00718.28
8.3.50.0140.00521.98
8.3.40.0110.00418.92
8.3.30.0120.00419.02
8.3.20.0000.00720.28
8.3.10.0060.00823.70
8.3.00.0060.00319.51
8.2.180.0080.00816.88
8.2.170.0150.00622.96
8.2.160.0170.00320.39
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0050.00320.47
8.2.120.0000.00826.35
8.2.110.0090.00019.22
8.2.100.0070.00417.72
8.2.90.0040.00419.17
8.2.80.0080.00017.97
8.2.70.0040.00417.50
8.2.60.0040.00717.77
8.2.50.0050.00318.07
8.2.40.0080.00021.11
8.2.30.0080.00020.64
8.2.20.0060.00317.61
8.2.10.0000.00818.06
8.2.00.0080.00017.90
8.1.280.0070.00725.92
8.1.270.0110.00423.97
8.1.260.0040.00428.09
8.1.250.0040.01128.09
8.1.240.0150.00022.05
8.1.230.0090.00320.99
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00717.70
8.1.180.0060.00318.10
8.1.170.0030.00618.27
8.1.160.0040.00421.95
8.1.150.0040.00418.83
8.1.140.0080.00019.34
8.1.130.0040.00417.58
8.1.120.0000.00717.24
8.1.110.0050.00317.34
8.1.100.0000.00717.48
8.1.90.0040.00417.42
8.1.80.0040.00417.41
8.1.70.0030.00317.45
8.1.60.0030.00717.64
8.1.50.0060.00317.48
8.1.40.0000.00817.49
8.1.30.0060.00317.54
8.1.20.0040.00417.54
8.1.10.0030.00517.52
8.1.00.0050.00217.43
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0040.00418.30
8.0.270.0070.00017.25
8.0.260.0070.00017.13
8.0.250.0030.00316.96
8.0.240.0060.00016.94
8.0.230.0070.00016.92
8.0.220.0000.00816.80
8.0.210.0070.00016.89
8.0.200.0070.00016.83
8.0.190.0060.00316.86
8.0.180.0000.00716.82
8.0.170.0040.00416.84
8.0.160.0040.00416.95
8.0.150.0060.00316.84
8.0.140.0020.00516.87
8.0.130.0000.00513.29
8.0.120.0000.00816.89
8.0.110.0050.00316.91
8.0.100.0000.00716.78
8.0.90.0030.00416.88
8.0.80.0130.00316.84
8.0.70.0000.00716.74
8.0.60.0030.00616.78
8.0.50.0080.00016.73
8.0.30.0040.01617.03
8.0.20.0100.00817.42
8.0.10.0080.00017.07
8.0.00.0100.00816.91
7.4.330.0050.00016.76
7.4.320.0030.00316.52
7.4.300.0060.00016.45
7.4.290.0030.00716.44
7.4.280.0090.00016.45
7.4.270.0030.00316.47
7.4.260.0100.00016.52
7.4.250.0040.00416.49
7.4.240.0060.00216.45
7.4.230.0070.00016.45
7.4.220.0090.00916.66
7.4.210.0060.01616.58
7.4.200.0070.00016.35
7.4.160.0060.01116.49
7.4.150.0070.01117.40
7.4.140.0080.01217.86
7.4.130.0130.01416.39
7.4.120.0130.01016.42
7.4.110.0030.01416.60
7.4.100.0230.00016.69
7.4.90.0060.01216.49
7.4.80.0110.00519.39
7.4.70.0100.00616.52
7.4.60.0120.01016.56
7.4.50.0080.00716.38
7.4.40.0150.00316.39
7.4.30.0030.01316.54
7.4.10.0070.01316.50
7.4.00.0100.00415.46
7.3.330.0030.00313.33
7.3.320.0060.00013.32
7.3.310.0080.00016.33
7.3.300.0040.00416.39
7.3.290.0040.01316.38
7.3.280.0090.01016.38
7.3.270.0100.00717.40
7.3.260.0140.00316.42
7.3.250.0120.00516.48
7.3.240.0060.01116.43
7.3.230.0060.01216.54
7.3.210.0140.00716.27
7.3.200.0120.00416.37
7.3.190.0130.00316.43
7.3.180.0060.00916.36
7.3.170.0070.01116.30
7.3.160.0110.01116.28
7.3.130.0150.00316.42
7.3.120.0070.01015.29
7.3.110.0050.01015.39
7.3.100.0030.01215.37
7.3.90.0050.00715.35
7.3.80.0070.00515.33
7.3.70.0100.00415.24
7.3.60.0100.00315.24
7.3.50.0040.01115.18
7.3.40.0070.00515.35
7.3.30.0080.00815.25
7.3.20.0060.00717.16
7.3.10.0050.01117.08
7.3.00.0080.00617.15
7.2.330.0070.01016.64
7.2.320.0140.00316.38
7.2.310.0040.01716.59
7.2.300.0060.01016.60
7.2.290.0110.00616.59
7.2.260.0090.00916.55
7.2.250.0070.01215.88
7.2.240.0020.01415.46
7.2.230.0020.01315.40
7.2.220.0100.00115.53
7.2.210.0080.00715.34
7.2.200.0030.00915.50
7.2.190.0060.00815.52
7.2.180.0050.00815.53
7.2.170.0050.00915.46
7.2.160.0030.01215.47
7.2.150.0080.00617.54
7.2.140.0080.00717.61
7.2.130.0060.00917.44
7.2.120.0030.01017.43
7.2.110.0220.01017.23
7.2.100.0100.00517.54
7.2.90.0110.00817.44
7.2.80.0060.00717.45
7.2.70.0070.00717.57
7.2.60.0090.00817.27
7.2.50.0090.00717.56
7.2.40.0020.01317.35
7.2.30.0060.00917.44
7.2.20.0050.00817.50
7.2.10.0050.01217.40
7.2.00.0040.00817.97
7.1.330.0070.00716.29
7.1.320.0080.00516.31
7.1.310.0060.00816.16
7.1.300.0050.00816.12
7.1.290.0080.00516.07
7.1.280.0040.00716.22
7.1.270.0060.00816.10
7.1.260.0040.01116.22
7.1.250.0030.01216.36
7.1.240.0040.01217.13
7.1.230.0030.00717.21
7.1.220.0070.01017.18
7.1.210.0060.00917.12
7.1.200.0090.00316.47
7.1.190.0040.00717.29
7.1.180.0040.01217.28
7.1.170.0070.00717.10
7.1.160.0040.01117.20
7.1.150.0090.00617.29
7.1.140.0040.00817.37
7.1.130.0070.01017.07
7.1.120.0070.00317.24
7.1.110.0130.00317.16
7.1.100.0060.00817.61
7.1.90.0060.00417.30
7.1.80.0040.01117.23
7.1.70.0040.00717.24
7.1.60.0090.01118.36
7.1.50.0060.00816.95
7.1.40.0070.00717.23
7.1.30.0060.01017.23
7.1.20.0070.01017.27
7.1.10.0040.00817.13
7.1.00.0020.04419.78
7.0.330.0000.01317.11
7.0.320.0070.01016.98
7.0.310.0030.01217.05
7.0.300.0000.01317.16
7.0.290.0030.01217.11
7.0.280.0160.00017.10
7.0.270.0040.01116.88
7.0.260.0040.00816.88
7.0.250.0040.01317.00
7.0.240.0070.01117.22
7.0.230.0040.00716.95
7.0.220.0090.00016.98
7.0.210.0030.01316.83
7.0.200.0020.01217.03
7.0.190.0080.00816.93
7.0.180.0060.00916.97
7.0.170.0040.00816.88
7.0.160.0060.00817.06
7.0.150.0030.01016.90
7.0.140.0030.01016.98
7.0.130.0030.01017.11
7.0.120.0030.01416.87
7.0.110.0040.00917.03
7.0.100.0090.00916.98
7.0.90.0030.01216.97
7.0.80.0000.01016.93
7.0.70.0070.00717.02
7.0.60.0030.02518.44
7.0.50.0120.02917.58
7.0.40.0090.02717.62
7.0.30.0140.02317.61
7.0.20.0180.04117.57
7.0.10.0070.03717.59
7.0.00.0090.04917.59
5.6.400.0000.01515.77
5.6.390.0100.00315.70
5.6.380.0110.00715.82
5.6.370.0110.00415.82
5.6.360.0080.01216.03
5.6.350.0060.00615.78
5.6.340.0140.00315.79
5.6.330.0030.01115.80
5.6.320.0060.01216.05
5.6.310.0040.01115.66
5.6.300.0100.00015.73
5.6.290.0120.00015.84
5.6.280.0080.03718.33
5.6.270.0120.00416.01
5.6.260.0000.01915.82
5.6.250.0070.00715.92
5.6.240.0080.00815.96
5.6.230.0000.01315.96
5.6.220.0050.00615.77
5.6.210.0080.04218.27
5.6.200.0000.03017.09
5.6.190.0090.03618.13
5.6.180.0250.04218.09
5.6.170.0150.03018.22
5.6.160.0050.05218.20
5.6.150.0060.02716.96
5.6.140.0090.04516.97
5.6.130.0100.02316.94
5.6.120.0080.03718.46
5.6.110.0080.04418.45
5.6.100.0060.04818.42
5.6.90.0130.04318.49
5.6.80.0090.04218.13
5.6.70.0040.01315.99
5.6.60.0120.00316.02
5.6.50.0000.01515.86
5.6.40.0030.00915.62
5.6.30.0060.00615.54
5.6.20.0100.00315.74
5.6.10.0030.01215.64
5.6.00.0030.00715.67
5.5.380.0060.00615.62
5.5.370.0090.00615.76
5.5.360.0060.00915.63
5.5.350.0100.03718.12
5.5.340.0070.04416.92
5.5.330.0030.04418.00
5.5.320.0100.04017.97
5.5.310.0120.04418.08
5.5.300.0080.02316.78
5.5.290.0080.02816.75
5.5.280.0040.02418.35
5.5.270.0070.04518.32
5.5.260.0090.02318.17
5.5.250.0110.03318.30
5.5.240.0200.03818.00
5.5.230.0040.01115.54
5.5.220.0100.00715.54
5.5.210.0100.01015.52
5.5.200.0000.01215.66
5.5.190.0040.00815.78
5.5.180.0060.00315.56
5.5.170.0090.00315.71
5.5.160.0000.01415.81
5.5.150.0060.00915.78
5.5.140.0100.00315.39
5.5.130.0030.00915.82
5.5.120.0030.01015.65
5.5.110.0060.00315.74
5.5.100.0040.01215.47
5.5.90.0110.00715.67
5.5.80.0100.00015.62
5.5.70.0040.00815.73
5.5.60.0030.01015.41
5.5.50.0100.00015.47
5.5.40.0150.00015.59
5.5.30.0070.01115.79
5.5.20.0080.01115.64
5.5.10.0070.01115.43
5.5.00.0000.01015.72

preferences:
91.52 ms | 401 KiB | 5 Q