3v4l.org

run code in 300+ PHP versions simultaneously
<?php # --- ENCRYPTION --- # the key should be random binary, use scrypt, bcrypt or PBKDF2 to # convert a string into a key # key is specified using hexadecimal $key = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029f"); # show key size use either 16, 24 or 32 byte keys for AES-128, 192 # and 256 respectively $key_size = strlen($key); echo "Key size: " . $key_size . "\n"; $plaintext = "This string was AES-256 / CBC / ZeroBytePadding encrypted."; # create a random IV to use with CBC encoding $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); # creates a cipher text compatible with AES (Rijndael block size = 128) # to keep the text confidential # only suitable for encoded input that never ends with value 00h # (because of default zero padding) $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_CBC, $iv); # prepend the IV for it to be available for decryption $ciphertext = $iv . $ciphertext; # encode the resulting cipher text so it can be represented by a string $ciphertext_base64 = base64_encode($ciphertext); echo $ciphertext_base64 . "\n"; # === WARNING === # Resulting cipher text has no integrity or authenticity added # and is not protected against padding oracle attacks. # --- DECRYPTION --- $ciphertext_dec = base64_decode($ciphertext_base64); # retrieves the IV, iv_size should be created using mcrypt_get_iv_size() $iv_dec = substr($ciphertext_dec, 0, $iv_size); # retrieves the cipher text (everything except the $iv_size in the front) $ciphertext_dec = substr($ciphertext_dec, $iv_size); # may remove 00h valued characters from end of plain text $plaintext_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec); echo $plaintext_dec . "\n"; ?>

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.0030.01218.56
8.3.50.0100.01021.22
8.3.40.0150.00019.02
8.3.30.0100.00319.07
8.3.20.0080.00020.34
8.3.10.0080.00021.89
8.3.00.0080.00019.26
8.2.180.0190.00318.13
8.2.170.0130.00422.96
8.2.160.0000.01419.50
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00419.77
8.2.110.0040.00419.27
8.2.100.0040.00817.91
8.2.90.0030.00717.75
8.2.80.0000.00817.97
8.2.70.0030.00517.93
8.2.60.0000.00918.22
8.2.50.0060.00318.10
8.2.40.0040.00419.26
8.2.30.0040.00419.25
8.2.20.0070.00017.72
8.2.10.0050.00218.17
8.2.00.0000.00717.77
8.1.280.0110.00425.92
8.1.270.0070.00319.00
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00722.02
8.1.230.0080.00420.95
8.1.220.0000.00817.74
8.1.210.0050.00318.95
8.1.200.0090.00017.35
8.1.190.0050.00317.34
8.1.180.0090.00018.10
8.1.170.0080.00018.51
8.1.160.0050.00218.82
8.1.150.0070.00018.82
8.1.140.0070.00017.45
8.1.130.0070.00017.89
8.1.120.0000.00717.41
8.1.110.0000.00717.46
8.1.100.0000.00717.50
8.1.90.0060.00317.36
8.1.80.0000.00717.54
8.1.70.0030.00317.44
8.1.60.0060.00317.61
8.1.50.0030.00517.46
8.1.40.0060.00317.41
8.1.30.0040.00417.67
8.1.20.0020.00517.50
8.1.10.0030.00517.60
8.1.00.0030.00617.44
8.0.300.0060.00319.98
8.0.290.0040.00416.63
8.0.280.0000.00718.42
8.0.270.0000.00817.28
8.0.260.0030.00317.27
8.0.250.0070.00016.91
8.0.240.0030.00617.01
8.0.230.0000.00816.98
8.0.220.0030.00316.89
8.0.210.0040.00316.98
8.0.200.0000.00616.93
8.0.190.0000.00817.02
8.0.180.0040.00417.02
8.0.170.0040.00416.96
8.0.160.0030.00317.00
8.0.150.0000.00716.94
8.0.140.0000.01016.89
8.0.130.0030.00313.41
8.0.120.0030.00616.92
8.0.110.0020.00516.96
8.0.100.0000.00716.92
8.0.90.0070.00016.77
8.0.80.0040.01116.94
8.0.70.0000.00816.96
8.0.60.0040.00416.98
8.0.50.0000.00716.90
8.0.30.0100.00817.15
8.0.20.0160.00617.40
8.0.10.0070.00016.86
8.0.00.0080.01016.63
7.4.330.0050.00015.06
7.4.320.0000.00716.46
7.4.300.0030.00316.50
7.4.290.0040.00416.63
7.4.280.0030.00516.66
7.4.270.0070.00016.52
7.4.260.0070.00016.65
7.4.250.0080.00016.41
7.4.240.0030.00316.50
7.4.230.0050.00316.43
7.4.220.0130.00616.66
7.4.210.0100.00516.67
7.4.200.0070.00016.70
7.4.160.0040.01216.70
7.4.150.0000.01817.40
7.4.140.0100.00717.86
7.4.130.0080.01316.62
7.4.120.0130.00716.46
7.4.110.0030.01416.61
7.4.100.0030.01416.64
7.4.90.0100.00716.47
7.4.80.0100.00616.56
7.4.70.0040.01416.50
7.4.60.0120.00616.68
7.4.50.0030.00516.74
7.4.40.0140.00316.68
7.4.30.0150.00716.55
7.4.10.0070.01114.89
7.4.00.0060.00915.10
7.3.330.0000.00713.32
7.3.320.0030.00313.29
7.3.310.0000.00716.37
7.3.300.0050.00216.31
7.3.290.0000.00716.27
7.3.280.0060.01416.42
7.3.270.0090.00917.40
7.3.260.0100.01016.68
7.3.250.0090.01016.56
7.3.240.0070.01016.66
7.3.230.0000.01716.39
7.3.210.0070.01116.64
7.3.200.0090.01019.39
7.3.190.0070.01016.51
7.3.180.0180.00016.25
7.3.170.0190.00616.34
7.3.160.0070.01016.43
7.3.130.0040.00814.84
7.3.120.0050.01315.12
7.3.110.0060.01014.90
7.3.100.0060.00914.93
7.3.90.0040.00914.84
7.3.80.0040.00814.85
7.3.70.0060.00914.91
7.3.60.0050.00814.70
7.3.50.0080.00514.85
7.3.40.0070.00614.76
7.3.30.0070.00814.85
7.3.20.0090.00515.99
7.3.10.0050.00916.18
7.3.00.0080.00716.05
7.2.330.0000.01816.72
7.2.320.0060.00916.73
7.2.310.0090.00916.69
7.2.300.0090.00916.57
7.2.290.0060.01616.36
7.2.260.0030.01614.77
7.2.250.0080.01115.07
7.2.240.0050.01115.18
7.2.230.0080.00715.08
7.2.220.0050.01015.08
7.2.210.0080.00714.96
7.2.200.0070.00614.96
7.2.190.0060.00714.92
7.2.180.0040.01015.10
7.2.170.0060.00715.12
7.2.160.0160.00515.16
7.2.150.0190.00315.98
7.2.140.0070.01216.00
7.2.130.0110.01016.08
7.2.120.0130.00916.05
7.2.110.0100.00816.00
7.2.100.0110.01216.09
7.2.90.0110.00716.12
7.2.80.0100.00915.97
7.2.70.0100.00916.00
7.2.60.0130.00816.38
7.2.50.0100.00916.17
7.2.40.0090.01115.99
7.2.30.0060.01016.19
7.2.20.0100.01216.13
7.2.10.0090.01216.11
7.2.00.0070.01017.19
7.1.330.0050.00815.07
7.1.320.0080.00614.93
7.1.310.0070.00715.02
7.1.300.0050.00815.13
7.1.290.0060.00914.95
7.1.280.0070.00715.10
7.1.270.0060.00915.09
7.1.260.0070.00815.00
7.1.250.0110.00414.70
7.1.240.0100.00714.79
7.1.230.0070.00914.81
7.1.220.0210.01014.69
7.1.210.0130.00814.80
7.1.200.0100.00515.20
7.1.190.0130.00914.79
7.1.180.0080.00714.96
7.1.170.0120.00514.97
7.1.160.0110.00614.79
7.1.150.0140.00514.83
7.1.140.0160.00614.87
7.1.130.0070.00814.88
7.1.120.0090.01214.84
7.1.110.0120.00914.87
7.1.100.0040.01015.84
7.1.90.0110.00614.79
7.1.80.0090.00514.78
7.1.70.0060.00815.41
7.1.60.0120.00816.28
7.1.50.0140.01121.44
7.1.40.0080.00715.00
7.1.30.0060.01114.77
7.1.20.0030.01314.91
7.1.10.0100.00814.76
7.1.00.0060.03617.33
7.0.330.0090.00614.36
7.0.320.0060.01114.32
7.0.310.0060.00814.51
7.0.300.0060.01014.36
7.0.290.0120.00314.58
7.0.280.0090.01014.53
7.0.270.0090.00514.41
7.0.260.0130.00314.28
7.0.250.0090.00914.42
7.0.240.0100.00814.33
7.0.230.0100.00714.50
7.0.220.0080.00714.57
7.0.210.0100.00614.42
7.0.200.0080.00515.24
7.0.190.0070.01214.48
7.0.180.0120.00514.43
7.0.170.0130.01414.52
7.0.160.0070.00914.47
7.0.150.0050.01214.52
7.0.140.0070.01717.02
7.0.130.0100.00714.56
7.0.120.0080.00914.60
7.0.110.0110.00714.38
7.0.100.0110.00814.51
7.0.90.0110.00514.51
7.0.80.0070.01014.48
7.0.70.0060.01114.51
7.0.60.0060.03416.20
7.0.50.0050.03515.57
7.0.40.0060.02415.72
7.0.30.0150.02015.69
7.0.20.0160.01815.67
7.0.10.0070.03615.79
7.0.00.0110.03315.84
5.6.400.0160.00614.41
5.6.390.0060.01214.28
5.6.380.0120.00714.20
5.6.370.0120.00514.18
5.6.360.0060.00714.22
5.6.350.0070.00814.45
5.6.340.0140.00614.35
5.6.330.0110.00714.13
5.6.320.0080.00814.36
5.6.310.0070.00614.38
5.6.300.0060.01013.99
5.6.290.0100.00514.20
5.6.280.0090.02716.57
5.6.270.0090.00814.16
5.6.260.0040.01214.23
5.6.250.0120.00214.16
5.6.240.0130.00314.40
5.6.230.0070.00914.25
5.6.220.0080.00614.37
5.6.210.0060.03516.35
5.6.200.0100.03015.56
5.6.190.0080.03416.32
5.6.180.0150.02116.27
5.6.170.0120.02616.32
5.6.160.0090.03616.37
5.6.150.0090.01715.71
5.6.140.0080.02015.49
5.6.130.0110.02915.42
5.6.120.0090.02616.66
5.6.110.0100.02716.55
5.6.100.0070.03316.52
5.6.90.0070.02116.56
5.6.80.0070.03216.24
5.6.70.0090.00514.19
5.6.60.0140.00714.27
5.6.50.0100.00514.03
5.6.40.0100.00814.19
5.6.30.0130.00614.04
5.6.20.0080.00914.29
5.6.10.0070.00714.21
5.6.00.0120.00614.18
5.5.380.0070.01013.96
5.5.370.0090.00814.11
5.5.360.0090.00414.03
5.5.350.0120.02216.20
5.5.340.0100.02815.64
5.5.330.0070.02116.21
5.5.320.0130.03316.22
5.5.310.0130.01816.28
5.5.300.0110.03015.32
5.5.290.0120.03015.55
5.5.280.0120.01516.45
5.5.270.0050.02016.30
5.5.260.0070.02416.34
5.5.250.0100.01716.32
5.5.240.0070.03316.06
5.5.230.0130.00414.09
5.5.220.0080.01013.92
5.5.210.0120.00514.13
5.5.200.0130.00813.98
5.5.190.0070.00914.29
5.5.180.0110.00514.28
5.5.170.0130.00613.98
5.5.160.0090.01114.18
5.5.150.0110.00614.02
5.5.140.0100.00414.16
5.5.130.0110.00314.09
5.5.120.0080.01114.09
5.5.110.0070.00814.24
5.5.100.0110.00714.11
5.5.90.0080.00814.07
5.5.80.0110.00614.28
5.5.70.0070.01114.03
5.5.60.0120.00714.03
5.5.50.0070.00914.08
5.5.40.0100.00614.22
5.5.30.0100.00714.19
5.5.20.0100.00614.32
5.5.10.0090.00614.03
5.5.00.0080.00813.73
5.4.450.0220.02214.30
5.4.440.0350.02114.29
5.4.430.0390.02214.40
5.4.420.0380.02014.30
5.4.410.0460.01814.38
5.4.400.0300.02114.20
5.4.390.0370.01914.28
5.4.380.0130.02114.11
5.4.370.0130.01814.10
5.4.360.0100.02214.07
5.4.350.0140.01914.03
5.4.340.0140.01914.14
5.4.330.0100.00411.84
5.4.320.0140.02314.16
5.4.310.0120.02914.20
5.4.300.0080.02414.09
5.4.290.0110.02114.20
5.4.280.0120.02114.01
5.4.270.0100.02214.11
5.4.260.0060.02814.01
5.4.250.0110.02214.09
5.4.240.0110.01914.08
5.4.230.0150.02214.04
5.4.220.0140.02214.12
5.4.210.0130.02014.11
5.4.200.0100.02113.34
5.4.190.0130.02014.06
5.4.180.0150.01714.11
5.4.170.0170.02314.09
5.4.160.0120.02113.96
5.4.150.0090.02513.98
5.4.140.0120.02213.35
5.4.130.0100.02213.27
5.4.120.0120.02313.30
5.4.110.0090.02113.26
5.4.100.0110.02013.30
5.4.90.0070.02513.31
5.4.80.0110.02213.18
5.4.70.0130.01913.23
5.4.60.0090.02013.32
5.4.50.0100.02313.25
5.4.40.0100.02113.25
5.4.30.0100.02113.27
5.4.20.0080.02313.33
5.4.10.0110.02013.13
5.4.00.0100.02013.14
5.3.290.0160.03013.65
5.3.280.0230.02213.61
5.3.270.0140.02913.61
5.3.260.0150.03013.62
5.3.250.0180.02413.63
5.3.240.0110.03013.66
5.3.230.0070.03313.64
5.3.220.0170.02313.64
5.3.210.0080.03513.64
5.3.200.0110.03213.62
5.3.190.0180.03013.59
5.3.180.0100.03113.68
5.3.170.0120.03213.62
5.3.160.0130.02813.59
5.3.150.0070.03313.64
5.3.140.0160.02613.63
5.3.130.0070.03813.66
5.3.120.0170.02713.62
5.3.110.0120.02913.67
5.3.100.0080.03213.41
5.3.90.0190.02313.36
5.3.80.0070.03613.31
5.3.70.0140.02813.41
5.3.60.0130.03813.35
5.3.50.0170.02413.29
5.3.40.0130.02813.29
5.3.30.0080.03113.27
5.3.20.0070.03513.16
5.3.10.0140.02613.15
5.3.00.0120.03213.15
5.2.170.0060.02711.96
5.2.160.0080.02211.95
5.2.150.0080.02312.00
5.2.140.0110.02111.93
5.2.130.0030.03111.93
5.2.120.0140.02211.98
5.2.110.0090.02411.90
5.2.100.0090.02411.90
5.2.90.0120.02211.89
5.2.80.0100.02811.91
5.2.70.0090.02511.97
5.2.60.0120.02411.87
5.2.50.0120.02011.89
5.2.40.0090.02311.85
5.2.30.0110.02811.83
5.2.20.0100.02111.86
5.2.10.0140.02011.82
5.2.00.0060.02611.80
5.1.60.0030.02511.36
5.1.50.0080.01911.45
5.1.40.0120.01411.38
5.1.30.0150.01511.55
5.1.20.0140.01611.57
5.1.10.0090.01711.45
5.1.00.0130.01511.44
5.0.50.0090.01410.72
5.0.40.0040.01710.56
5.0.30.0060.02310.48
5.0.20.0090.01210.47
5.0.10.0070.01410.50
5.0.00.0050.02210.50
4.4.90.0090.0089.31
4.4.80.0040.0139.35
4.4.70.0080.0109.31
4.4.60.0020.0169.32
4.4.50.0080.0089.29
4.4.40.0050.0199.31
4.4.30.0090.0089.27
4.4.20.0030.0159.35
4.4.10.0050.0129.30
4.4.00.0100.0159.34
4.3.110.0000.0179.32
4.3.100.0060.0119.27
4.3.90.0060.0139.25
4.3.80.0050.0209.29
4.3.70.0030.0149.29
4.3.60.0050.0129.29
4.3.50.0070.0109.26
4.3.40.0030.0189.27
4.3.30.0020.0158.67
4.3.20.0060.0108.66
4.3.10.0010.0138.64
4.3.00.0230.01513.61

preferences:
65.07 ms | 401 KiB | 5 Q