title: Using eval to read an encrypted file
body: <p>I have a php file which was encrypted using <code>mcrypt</code> and now we need to decrypt it.</p>
  
  <p>Here is the decryption:</p>
  
  <pre><code>abstract class Encryption_Abstract {
      const CYPHER = 'blowfish';
      const MODE = 'cfb';
      protected $key;
      public
      function __construct($key) {
          $this-&gt;key = $key;
      }
      public function encrypt($plaintext) {
          return $plaintext;
      }
      public function decrypt($crypttext) {
          return $crypttext;
      }
  }
  //decryptor
  class Decryption extends Encryption_Abstract {
      function decrypt($crypttext) {
          $plaintext = '';
          $td = mcrypt_module_open(self::CYPHER, '', self::MODE, '');
          $ivsize = mcrypt_enc_get_iv_size($td);
          $iv = substr($crypttext, 0, $ivsize);
          $crypttext = substr($crypttext, $ivsize);
          if ($iv) {
              mcrypt_generic_init($td, $this - &gt; key, $iv);
              $plaintext = mdecrypt_generic($td, $crypttext);
          }
          return $plaintext;
      }
  }
  </code></pre>
  
  <p>Now this is how we instantiate it and then use it:</p>
  
  <pre><code>$enc = new Decryption(KEYS::PROD);  //KEYS::PROD is the decryption key
  eval($enc-&gt;decrypt(file_get_contents("key_file.txt"))); //&lt;--
  </code></pre>
  
  <p>Is there any way to <strong>not</strong> use <code>eval</code>? or is it my only option?</p>