Assign expression to the arc and execute it
<p>I need to implement the following thing in my web-application. I know my solution is incorrect, but I put the code jsut to demonstrate the idea.</p>

<p>There is a class 'arc'. I need to be able to assign ANY expression to this arc (e.g. a+b+c,a-c,if-then). Once expression is assigned, I'd like to be able to execute it with some randomly taken variables. Is it possible to implement such functionality in web-applications? Maybe, I should use some plug-in like MathPL? Or maybe there is an absolutely different approach to tackle such kind of problems?</p>

<pre><code>class arc {

    var $arcexpression;

    function setExpression($arcexpression) {
        $this-&gt;arcexpression = $arcexpression;
    }

    function getExpression() {
        return $this-&gt;arcexpression;
    }


}

$arc = new arc();

$arc-&gt;setExpression("if a&gt;b then return a else return b");

$result = $arc-&gt;execute(a,b);  // the function 'execute' should be somehow described in 'arc'
</code></pre>
