Let's consider following code:

```
/**
 * @param  string $exp  expression
 * @param  number $var1
 * @param  number $var2 
 * @return json
 */
  public function calculate($exp, $var1, $var2) {}

```

What is the quickest and most elegant way to handle this calculate function?

Am I restricted to the 'switch'? Or is it possible to somehow implement the

```
$var1 . $exp . $var2

```

Which will result in the sum instead of string?

Did some heavy research on that, it's really trivial problem but it got me thinking for an few hours now.