andersonrezende / formula-executor
Formula converter and executor in string format
v1.0.0
2023-07-03 21:26 UTC
Requires
- php: >=7.0
Requires (Dev)
- pestphp/pest: ^2.8
This package is auto-updated.
Last update: 2025-01-04 00:50:45 UTC
README
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();