3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Encryption { public function decrypt($string) { $output = false; $key = 'myKey';//must be same as of encryption // initialization vector $iv = md5(md5($key)); $output = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, $iv); $output = base64_encode($output); return $output; } public function encrypt($string) { $output = false; $key = 'myKey'; // initialization vector $iv = md5(md5($key)); $output = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, $iv); $output = base64_encode($output); return $output; } public function encryptData($input) { $output = trim(base64_encode(base64_encode($input)), '=='); $output = $this->encrypt($input); return $output; } public function decryptData($input) { $output = base64_decode(base64_decode($input)); $output = $this->decrypt($input); return $output; } } $test = new Encryption(); echo $test->encryptData("Narendra")."\n"; echo $test->decryptData("Narendra");
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() in /in/7mCUJ:26 Stack trace: #0 /in/7mCUJ(34): Encryption->encrypt('Narendra') #1 /in/7mCUJ(48): Encryption->encryptData('Narendra') #2 {main} thrown in /in/7mCUJ on line 26
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:
47.06 ms | 401 KiB | 8 Q