3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sSecretKey = 'TrueID2015tRUEid'; $json = json_encode($input); $encrypt = fnEncrypt($json, $sSecretKey); function fnEncrypt($sValue, $sSecretKey) { $iv = base64_decode('Jc8EZ9nZPbWZEoV4ad8/CQ=='); $sValue = pkcs5_pad($sValue, mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $sValue = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $sSecretKey, $sValue, MCRYPT_MODE_CBC, $iv); $sValue = base64_encode($sValue); return $sValue; } function pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); $pad2 = $text . str_repeat(chr($pad), $pad); return $pad2; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $input in /in/M0c7N on line 3 Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/M0c7N:8 Stack trace: #0 /in/M0c7N(4): fnEncrypt('null', 'TrueID2015tRUEi...') #1 {main} thrown in /in/M0c7N on line 8
Process exited with code 255.
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: input in /in/M0c7N on line 3 Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/M0c7N:8 Stack trace: #0 /in/M0c7N(4): fnEncrypt('null', 'TrueID2015tRUEi...') #1 {main} thrown in /in/M0c7N on line 8
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /in/M0c7N:8 Stack trace: #0 /in/M0c7N(4): fnEncrypt('null', 'TrueID2015tRUEi...') #1 {main} thrown in /in/M0c7N on line 8
Process exited with code 255.
Output for 5.5.0 - 5.5.34, 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Notice: Undefined variable: input in /in/M0c7N on line 3
Output for 5.5.35 - 5.5.38, 5.6.21 - 5.6.28
Notice: Undefined variable: input in /in/M0c7N on line 3 Fatal error: Call to undefined function mcrypt_get_block_size() in /in/M0c7N on line 8
Process exited with code 255.

preferences:
172.1 ms | 402 KiB | 238 Q