3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key1 = "this is a secret key"; $key2 = "this is the second secret key"; $input = "Let us meet at 9 o'clock at the secret place."; $length = strlen($input); /* Open the cipher */ $td = mcrypt_module_open('rijndael-256', '', 'cbc', ''); /* Create the IV and determine the keysize length, use MCRYPT_RAND * on Windows instead */ $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); $ks = mcrypt_enc_get_key_size($td); /* Create key */ $key1 = md5($key1); $key2 = md5($key2); $key = substr($key1, 0, $ks/2) . substr(strtoupper($key2), (round(strlen($key2) / 2)), $ks/2); $key = substr($key.$key1.$key2.strtoupper($key1),0,$ks); /* Intialize encryption */ mcrypt_generic_init($td, $key, $iv); /* Encrypt data */ $encrypted = mcrypt_generic($td, $input); /* Terminate encryption handler */ mcrypt_generic_deinit($td); /* Initialize encryption module for decryption */ mcrypt_generic_init($td, $key, $iv); /* Decrypt encrypted string */ $decrypted = mdecrypt_generic($td, $encrypted); /* Terminate decryption handle and close module */ mcrypt_generic_deinit($td); mcrypt_module_close($td); /* Show string */ echo "Text: ".substr($decrypted,0,$length) . "<br>"; echo "Encoded: ".$encrypted ."<br>"; echo "<br>key1: $key1 <br>key2: $key2<br>created key: $key";
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mcrypt_module_open() in /in/DhQQe:8 Stack trace: #0 {main} thrown in /in/DhQQe on line 8
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
54.85 ms | 401 KiB | 8 Q