https://github.com/andersonrezende/formula-executor
Formula converter and executor in string format
https://github.com/andersonrezende/formula-executor
addition division executor exponentiation formula infix math multiplication notation polish postfix subtraction
Last synced: 2 months ago
JSON representation
Formula converter and executor in string format
- Host: GitHub
- URL: https://github.com/andersonrezende/formula-executor
- Owner: AndersonRezende
- License: mit
- Created: 2023-06-20T13:29:42.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-03T21:28:42.000Z (almost 2 years ago)
- Last Synced: 2025-01-05T09:43:45.474Z (4 months ago)
- Topics: addition, division, executor, exponentiation, formula, infix, math, multiplication, notation, polish, postfix, subtraction
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# formula-executor 
Simple math expression calculator## Install:
```
$ composer require nxp/math-executor
```## Support:
* Multiplication
* Division
* Addition
* Subtraction
* Exponentiation
* Parentheses## Basic usage:
```php
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();
```