Simple math expression calculator
$ composer require nxp/math-executor
- Multiplication
- Division
- Addition
- Subtraction
- Exponentiation
- Parentheses
use Andersonrezende\FormulaExecutor\FormulaExecutor;
$formula = '(a * (b + c) / d - e)';
$values = array('a' => 5, 'b' => 3, 'c' => 2, 'd' => 4, 'e' => 6);
$formulaExecutor = new FormulaExecutor($formula, $values);
$resultFormula = $formulaExecutor->execute();