Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 597 Bytes

README.md

File metadata and controls

26 lines (21 loc) · 597 Bytes

formula-executor Tests

Simple math expression calculator

Install:

$ composer require nxp/math-executor

Support:

  • Multiplication
  • Division
  • Addition
  • Subtraction
  • Exponentiation
  • Parentheses

Basic usage:

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();