Skip to content

AndersonRezende/formula-executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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