3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* * PHP mcrypt - Basic encryption and decryption of a string */ $string = "Some text to be encrypted"; $secret_key = "ERG$FGBGqFN.GAS~SANTYJY<UOFGBKLUIDGSAKL?ASDFB"; $encrypted_string = "yUOLMue2f3oUba5P2nqUQZ2_PBnb3cWFkoFg4l_c7QUTd4V_fIeuILLpLIgIYgcELpTryfXdZ006rk7ecksf9ej91pmFOeQ_uJa_jHJkUfaaWsZpe_bm3ouoyWzZTjMFSB4Moi26oQZCiMUxiITtAQelQutV5L9eGntJWFE1fBWPx__rcC97UsMYHIT_AxHLRCXEow8zgIS4iaMhcICggpS_Xrh2ZzkM4qonQaHDD1dyJ_xHfftza_KFd4x4a9rQUyORtiWkocN87LYpwNW_Lvz6KRtWiakUs9JIDBCwutzbXby8Om4b0kyUEVU0EXsTXiio2wO_sgnCuaTK0C0nfvJXBx2NXKNd_8P17uvBFnfoxzCf13ztHEyhT8CGB5UJdrFYbY1jz_5y8Qo40aQjxA=="; // Create the initialization vector for added security. // $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); // Encrypt $string //$encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $secret_key, $string, MCRYPT_MODE_CBC, $iv); // Decrypt $string $decrypted_string = mdecrypt_generic($secret_key, $encrypted_string); echo "Original string : " . $string . "<br />\n"; //echo "Encrypted string : " . $encrypted_string . "<br />\n"; echo "Decrypted string : " . $decrypted_string . "<br />\n"; ?>
based on h0J0O
Output for 7.0.6 - 7.2.0
Notice: Undefined variable: FGBGqFN in /in/rHQFr on line 6 Fatal error: Uncaught Error: Call to undefined function mdecrypt_generic() in /in/rHQFr:16 Stack trace: #0 {main} thrown in /in/rHQFr on line 16
Process exited with code 255.
Output for 5.4.0 - 5.5.34, 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
Notice: Undefined variable: FGBGqFN in /in/rHQFr on line 6 Warning: mdecrypt_generic() expects parameter 1 to be resource, string given in /in/rHQFr on line 16 Original string : Some text to be encrypted<br /> Decrypted string : <br />
Output for 5.3.19 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Notice: Undefined variable: FGBGqFN in /in/rHQFr on line 6 Fatal error: Call to undefined function mdecrypt_generic() in /in/rHQFr on line 16
Process exited with code 255.