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&7d6sj6w6hfkjhvfDw20');
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function mcrypt_module_open() in /in/NIqJH:11 Stack trace: #0 /in/NIqJH(25): encrypt('sup#own#hnf#15', 'jhfjdjj%6s77w', '234ghyjdGtskjd&...') #1 {main} thrown in /in/NIqJH on line 11
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.34, 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 34, needed: 32 in /in/NIqJH on line 12 3233346768796a644774736b6a6426376436736a36773668666b6a68766644773230596659385971766d763952656b466867744c6f3035545168484361694b346c737a6b7231782f6d7067454d3d
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.5.35 - 5.5.38, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_module_open() in /in/NIqJH on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/NIqJH 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/NIqJH on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/NIqJH on line 7
Process exited with code 255.

preferences:
271.97 ms | 401 KiB | 356 Q