title: PHP code from a file does not execute
body: <p>I am working on a BB code system for a content manager and I want to be able to use something like <code>[code=php]&lt;?php echo "Hello World!"; ?&gt;[/code]</code> in my textarea. Using GeSHi (A syntax highlighter) I have made the following function to parse the code:</p>
  
  <pre><code>function parsecode($codetype) {
      $source = file_get_contents("file.php"); 
      $language = $codetype; 
      $geshi = new GeSHi($source, $language); 
      echo '&lt;code class="num"&gt;', implode(range(1,count(file("file.php"))), "&lt;br /&gt;"), "&lt;/code&gt;"; 
      echo $geshi-&gt;parse_code();
  }
  </code></pre>
  
  <p>This works perfectly fine!</p>
  
  <p>Now this is where the BB code comes in. Using preg_replace I made a simple system that finds and replaces bits of code:</p>
  
  <pre><code>$find = array( 
    "/\[code\=(.+?)\](.+?)\[\/code\]/is"
  );
  $replace = array(
    '&lt;?php parsecode("$1"); ?&gt;'
  );
  </code></pre>
  
  <p>Yes, for now this means it only reads the language and parses the file "file.php" but eventually I will have this work different, but that's not important for now. </p>
  
  <p>What happens, is that the BB code gets executed correctly, and the result is that it does in fact execute the code, but it does NOT execute the function <code>parsecode()</code> . I made a small adjustment to find out where the problem is, and made it save to a file and it turns out the file contained the following: <code>&lt;?php parsecode("php"); ?&gt;</code> . Which is exactly what it should contain. When I write this line of code in the file, it executes.</p>
  
  <p>Anything submitted in the textarea gets stored in a file, which is then read using <code>fopen()</code> and then echo'd on a different page.</p>
  
  <p>My question: Why does the function not execute &amp; parse the code like it should?</p>
  
  <p>Thanks ahead!</p>