3v4l.org

run code in 300+ PHP versions simultaneously
<?php $algo = 'aes-256-gcm'; $iv = random_bytes(openssl_cipher_iv_length($algo)); $key = random_bytes(32); // 256 bit //$data = random_bytes(1024); // 1 Kb of random data $data = "well hello there"; $ciphertext = openssl_encrypt( $data, $algo, $key, OPENSSL_RAW_DATA, $iv, $tag ); // Change 1 bit in ciphertext // $i = rand(0, mb_strlen($ciphertext, '8bit') - 1); // $ciphertext[$i] = $ciphertext[$i] ^ chr(1); echo(base64_encode($ciphertext)); echo("\n"); echo(base64_encode($tag)); $i = rand(0, mb_strlen($tag, '8bit') - 1); $tag[$i] = $tag[$i] ^ chr(1); echo("\n"); echo(base64_encode($tag)); $decrypt = openssl_decrypt( $ciphertext, $algo, $key, OPENSSL_RAW_DATA, $iv, $tag ); if (false === $decrypt) { throw new Exception(sprintf( "OpenSSL error: %s", openssl_error_string() )); } printf ("Decryption %s\n", $data === $decrypt ? 'Ok' : 'Failed');

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)
7.4.00.0070.01015.05
7.3.120.0040.00814.96
7.3.110.0060.00914.86
7.3.100.0060.01214.55
7.3.90.0110.00314.80
7.3.80.0100.00714.83
7.3.70.0130.00014.90
7.3.60.0060.00914.69
7.3.50.0030.01214.96
7.3.40.0060.00614.89
7.3.30.0030.00914.85
7.3.20.0060.00616.74
7.3.10.0100.00616.62
7.3.00.0090.00916.61
7.2.250.0040.01414.80
7.2.240.0040.01515.10
7.2.230.0100.00315.06
7.2.220.0090.00614.84
7.2.210.0000.01814.89
7.2.200.0030.00915.09
7.2.190.0100.00714.77
7.2.180.0060.00915.01
7.2.170.0120.00314.89
7.2.160.0060.00914.89
7.2.150.0090.00316.71
7.2.140.0030.00916.87
7.2.130.0160.00316.70
7.2.120.0090.00616.71
7.2.110.0070.00716.90
7.2.100.0100.00716.84
7.2.90.0170.01215.60
7.2.80.0180.00615.73
7.2.70.0210.00515.94
7.2.60.0250.01215.97
7.2.50.0160.00916.00
7.2.40.0240.00515.89
7.2.30.0090.00915.65
7.2.20.0160.00215.76
7.2.10.0260.00815.91
7.2.00.0050.00915.63
7.1.330.0000.01715.57
7.1.320.0090.00915.39
7.1.310.0110.00715.66
7.1.300.0060.01015.59
7.1.290.0110.00415.75
7.1.280.0030.01015.65
7.1.270.0060.00915.55
7.1.260.0030.01315.53
7.1.250.0070.01015.50
7.1.240.0070.00415.66
7.1.230.0040.01215.60
7.1.220.0030.01015.64
7.1.210.0250.01014.65
7.1.200.0280.00214.70
7.1.190.0520.00814.77
7.1.180.0070.00914.79
7.1.170.0290.00014.44
7.1.160.0200.00914.77
7.1.150.0250.00514.57
7.1.140.0060.00714.59
7.1.130.0220.00714.75
7.1.120.0180.00714.75
7.1.110.0240.00814.82
7.1.100.0240.00914.51
7.1.90.0240.00914.74
7.1.80.0240.00614.58
7.1.70.0350.00714.76
7.1.60.0140.01023.85
7.1.50.0340.00623.78
7.1.40.0250.01423.76
7.1.30.0330.01223.71
7.1.20.0440.00623.63
7.1.10.0320.00514.54
7.1.00.0090.00914.56
7.0.330.0000.01515.08
7.0.320.0030.00915.21
7.0.310.0060.00614.27
7.0.300.0280.00614.31
7.0.290.0100.00614.36
7.0.280.0410.00714.36
7.0.270.0150.01014.40
7.0.260.0210.00814.25
7.0.250.0230.00814.57
7.0.240.0250.00814.42
7.0.230.0230.00714.28
7.0.220.0210.01114.27
7.0.210.0290.00314.43
7.0.200.0390.00614.39
7.0.190.0220.00814.21
7.0.180.0260.01014.53
7.0.170.0230.00814.43
7.0.160.0230.00714.42
7.0.150.0230.00814.37
7.0.140.0200.01114.42
7.0.130.0390.00814.35
7.0.120.0070.01014.34
7.0.110.0570.00914.51
7.0.100.0260.00314.21
7.0.90.0090.00614.48
7.0.80.0210.01014.38
7.0.70.0180.00914.36
7.0.60.0080.00614.44
7.0.50.0240.00814.55
7.0.40.0090.00713.44
7.0.30.0270.00313.48
7.0.20.0110.00613.46
7.0.10.0140.00513.36
7.0.00.0060.00913.50
5.6.400.0030.01314.23
5.6.390.0030.01014.08
5.6.380.0030.01614.18
5.6.370.0040.01413.97
5.6.360.0000.01414.00
5.6.350.0060.00914.29
5.6.340.0030.01014.36
5.6.330.0060.00614.29
5.6.320.0090.00614.16
5.6.310.0030.00614.18
5.6.300.0160.00314.24
5.6.290.0090.00614.35
5.6.280.0060.01214.13
5.6.270.0030.01013.86
5.6.260.0000.01613.96
5.6.250.0000.01013.99
5.6.240.0090.00614.19
5.6.230.0070.01014.00
5.6.220.0000.01314.00
5.6.210.0030.00714.15
5.6.200.0100.00714.11
5.6.190.0090.00914.02
5.6.180.0070.01114.32
5.6.170.0070.00414.32
5.6.160.0110.00414.29
5.6.150.0120.00414.18
5.6.140.0090.00614.29
5.6.130.0030.01314.28
5.6.120.0100.00714.33
5.6.110.0060.01014.34
5.6.100.0070.00714.27
5.6.90.0090.00413.90
5.6.80.0120.00313.81
5.6.70.0070.00713.88
5.6.60.0030.01014.32
5.6.50.0070.00713.94
5.6.40.0110.00614.05
5.6.30.0060.01014.32
5.6.20.0030.00613.98
5.6.10.0000.01414.18
5.6.00.0100.00313.82

preferences:
70.68 ms | 401 KiB | 5 Q