3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt($texttocrypt, $ky, $iv) { // $ky = '5rrdv4lkjdshfkl43bgd'; // Key from file // $iv = ; try { $encrypted = ""; $length = strlen($texttocrypt); $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''); mcrypt_generic_init($cipher, $ky, $iv); $encrypted = base64_encode(mcrypt_generic($cipher, $texttocrypt)); mcrypt_generic_deinit($cipher); $result1 = bin2hex($iv); $result2 = bin2hex($encrypted); $result = $result1 . $result2; return $result; } catch (Exception $e) { $this->lastError = "Error while encrypting '".$texttocrypt."' - ".$e->getMessage(); throw new Exception($this->lastError); } } echo encrypt('sup#own#hnf#15', 'jhfjdjj%6s77w', '234ghyjdGtskjd&7d6sj6w6hfkvfDw20');
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Call to undefined function mcrypt_module_open() in /in/REks1:11 Stack trace: #0 /in/REks1(25): encrypt('sup#own#hnf#15', 'jhfjdjj%6s77w', '234ghyjdGtskjd&...') #1 {main} thrown in /in/REks1 on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined function mcrypt_module_open() in /in/REks1 on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/REks1 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '{' in /in/REks1 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/REks1 on line 7
Process exited with code 255.

preferences:
326.17 ms | 401 KiB | 455 Q