title: PHP eval() code in between <?php ?> from database
body: <p>I want to be able to put PHP into the database and run it.  I have to do this because I store page layouts in the database and each our different for each other, however in some cases I want to use dynamic content for some of the pages.</p>
  
  <p>Assume <code>$query_from_db</code> is the string returned from the database.  PHP should only eval() the code in between <code>&lt;?php</code> and <code>?&gt;</code> </p>
  
  <pre>
  $query_from_db  = '&lt;div&gt;
  &lt;?php
  
  //php to run
  function dosomething() {
       //bleh
  }
  
  ?&gt;
  &lt;/div&gt;
  ';
  
  
  php echo eval($query_from_db);
  </pre>
  
  <p>How can I do this? I'm aware this is not recommended.</p>