loading...

Discussion on: Daily Challenge #10 - Calculator

Collapse
celyes profile image
Ilyes Chouia

a bit late... this is the solution in PHP

function evaluate(string $x){
    return eval('return '.$x.';');
}
echo evaluate("2 / 2 + 3 * 4 - 6");