3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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; }
based on mC4MF
Output for 7.0.6 - 7.2.0
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 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.