3v4l.org

run code in 300+ PHP versions simultaneously
<?php const ENC_METHOD = 'aes-256-ctr'; const ENC_SALT = "87CD2488-180D-442B-A68A-0307DC0CAB4D"; function B2R_Encrypt($message, $key) { $key = hash("sha256", ENC_SALT, FALSE); //$key = hash("sha256", ENC_SALT + $key, TRUE); echo $key; $nonceSize = openssl_cipher_iv_length(ENC_METHOD); $nonce = openssl_random_pseudo_bytes($nonceSize); $ciphertext = openssl_encrypt( $message, ENC_METHOD, $key, OPENSSL_RAW_DATA, $nonce ); $result = base64_encode($nonce.$ciphertext); echo $result + ''\n'; return $result; } $message = 'Some test password'; $encrypted = B2R_Encrypt($message, ''); echo $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)
7.1.10.0100.06722.25
7.1.00.0030.06322.38
7.0.150.0070.06021.89
7.0.140.0030.07721.85
7.0.130.0070.05722.01
7.0.120.0130.05021.91
7.0.110.0130.05321.89
7.0.100.0030.07721.87
7.0.90.0170.07721.91
7.0.80.0130.07021.82
7.0.70.0070.06021.85
7.0.60.0070.06021.60
7.0.50.0100.05321.92
7.0.40.0000.06021.99
7.0.30.0030.06021.76
7.0.20.0100.05321.88
7.0.10.0030.06021.98
7.0.00.0030.06021.94

preferences:
141.57 ms | 1394 KiB | 7 Q