title: Alternative to PHP eval?
body: <p>I have some code that is returned to my script in a variable.  I need to execute it as PHP code but am nervous to use the <code>eval</code> function.  Here is the code that is generated in an include file:</p>
  
  <p>/include.php:</p>
  
  <pre><code>$preLoadFields .=   '$2 = new KoolDatePicker("datepicker");                                    
                       $2-&gt;id="field_2";                              
                       $2-&gt;scriptFolder = "/KoolPHP";
  </code></pre>
  
  <p>/main.php</p>
  
  <pre><code>eval($preLoadFields);
  </code></pre>
  
  <p>Even when I try to run it using <code>eval</code>, I get this error:</p>
  
  <p>Parse error: syntax error, unexpected '2' (T_LNUMBER), expecting variable (T_VARIABLE) or '$'</p>
  
  <p>Is there a better / safer way to do accomplish this?  Thank you in advance!</p>