title: calculate math expression from a string using eval
body: <p>I want to calculate math expression from a string. I have read that the solution to this is to use eval(). But when I try to run the following code:</p>
  
  <pre><code>&lt;?php
  
  $ma ="2+10";
  $p = eval($ma);
  print $p;
  
  ?&gt;
  </code></pre>
  
  <p>It gives me the following error:</p>
  
  <blockquote>
    <p>Parse error: syntax error, unexpected $end in
    C:\xampp\htdocs\eclipseWorkspaceWebDev\MandatoryHandinSite\tester.php(4)
    : eval()'d code on line 1</p>
  </blockquote>
  
  <p>Does someone know the solution to this problem.</p>