3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cipher { private $securekey, $iv; function __construct($textkey) { $this->securekey = hash('sha256',$textkey,TRUE); $this->iv = mcrypt_create_iv(32); } function encrypt($input) { return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->securekey, $input, MCRYPT_MODE_ECB, $this->iv)); } function decrypt($input) { return rtrim(trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->securekey, base64_decode($input), MCRYPT_MODE_ECB, $this->iv)),"\0"); } } $cipher = new Cipher('secret passphrase'); $encryptedtext = $cipher->encrypt("hide me"); echo "->encrypt = $encryptedtext<br />"; $decryptedtext = $cipher->decrypt($encryptedtext); echo "->decrypt = $decryptedtext<br />"; var_dump($decryptedtext);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/i6vFP:7 Stack trace: #0 /in/i6vFP(17): Cipher->__construct('secret passphra...') #1 {main} thrown in /in/i6vFP on line 7
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:
42.74 ms | 401 KiB | 8 Q