Validate user inputted PHP code before passing it to eval()
<p>Before passing a string to eval() I would like to make sure the syntax is correct and allow:</p>

<ol>
<li>Two functions: a() and b()</li>
<li>Four operators: /*-+</li>
<li>Brackets: ()</li>
<li>Numbers: 1.2, -1, 1</li>
</ol>

<p>How can I do this, maybe it has something to do with PHP Tokenizer?</p>

<p>I'm actually trying to make a simple formula interpreter so a() and b() will be replaced by ln() and exp(). I don't want to write a tokenizer and parser from scratch.</p>
