how to perform operations with operator symbol saved in a variable
<p>guys this is a simple question for most of you probably. but im confused on how can i perform operations with operator symbol saved in a variable. Example. </p>

<pre><code>$first=5;
$second=5;
$operator="+";

$result=$first.$operator.$second;

echo $result;
</code></pre>

<p>but $result will just print 5+5. i want it to perform the operation.</p>

<p>my idea is to put it all operations in an if condition -> if($operator == '+'){add the first and second operand}. any other ideas guys?</p>
