3v4l.org

run code in 300+ PHP versions simultaneously
<?php $res = openssl_pkey_new([ 'digest_alg' => 'sha256', 'private_key_bite' => 2048, 'private_key_type' => OPENSSL_TYPE_RSA ]); openssl_pkey_export($res, $privateKey); $publicKey = openssl_pkey_get_details($res)['key']; $message = 'Prime Numbers Rock!'; $aesKey = random_bytes(32); $keyE = hash_hmac('sha256', 'Encryption Key', $aesKey, true); $keyA = hash_hmac('sha256', 'Authentication Key', $aesKey, true); $iv = random_bytes(12); $ciphertext = $iv . openssl_encrypt($message, 'aes-256-ctr', $keyE, OPENSSL_RAW_DATA, $iv); $mac = hash_hmac('sha256', $ciphertext, $keyA, true); $combined = $mac . $ciphertext; $rsaCipher = ''; openssl_public_encrypt($key, $rsaCihper, $publicKey, OPENSSL_PKCS1_OAEP_PADDING); $sendMe = $rsaCipher . $combined; var_dump(strlen($rsaCipher), strlen($combined), strlen($sendMe));

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.2.00.0060.00619.34
7.1.100.0060.00618.36
7.1.70.0000.01017.21
7.1.60.0030.01719.90
7.1.50.0130.01016.84
7.1.00.0070.14022.52
7.0.200.0480.00714.76
7.0.70.1030.27320.34
7.0.60.1100.27320.22
7.0.50.1130.27320.77
7.0.40.1070.11720.66
7.0.30.1100.10320.50
7.0.20.1070.18320.64
7.0.10.0930.14020.78
7.0.00.0970.07720.65
5.6.280.0000.13721.23
5.6.220.0870.11720.94
5.6.210.0830.13720.89
5.6.200.1070.33321.18
5.6.190.0870.18021.23
5.6.180.0930.25321.13
5.6.170.0900.22321.22
5.6.160.0800.22721.34
5.6.150.0900.08021.21
5.6.140.0830.15721.45
5.6.130.0730.32721.43
5.6.120.0100.15721.23
5.6.110.0530.30021.34
5.6.100.1000.09321.34
5.6.90.0930.44021.15
5.6.80.0830.15720.56
5.6.70.0930.12020.58
5.6.60.0730.13320.72
5.6.50.0900.10720.76
5.6.40.0970.23720.61
5.6.30.0800.14720.60
5.6.20.0830.29720.81
5.6.10.0870.21720.59
5.6.00.0770.43720.68
5.5.360.0970.15720.61
5.5.350.0770.25320.80
5.5.340.0900.16321.09
5.5.330.0970.15021.21
5.5.320.1070.11320.95
5.5.310.0770.13021.02
5.5.300.1030.10321.03
5.5.290.0930.15721.09
5.5.280.0100.20021.09
5.5.270.0830.26721.23
5.5.260.1000.24021.09
5.5.250.1100.21721.05
5.5.240.0730.21020.59
5.5.230.0900.11720.53
5.5.220.0800.12320.48
5.5.210.0970.32020.63
5.5.200.1100.21320.45
5.5.190.0730.13320.54
5.5.180.1100.26320.38
5.5.160.0900.20320.39
5.5.150.0770.05720.39
5.5.140.1130.06020.41
5.5.130.0870.05720.37
5.5.120.0830.05320.39
5.5.110.1100.06020.27
5.5.100.1100.07320.29
5.5.90.0830.07020.19
5.5.80.1000.07020.16
5.5.70.0900.05720.18
5.5.60.0730.06720.34
5.5.50.0800.06320.27
5.5.40.0930.05020.18
5.5.30.0770.06720.11
5.5.20.0830.07720.24
5.5.10.0970.06320.18
5.5.00.1100.06720.16

preferences:
34.93 ms | 401 KiB | 5 Q