dev-master
9999999-devFormula
GPL
The Requires
- php ^7.0
The Development Requires
by Social IST
0.1.0
0.1.0.0Formul parser
GPL
The Requires
- php ^7.0
The Development Requires
by Social IST
Wallogit.com
2017 © Pedro Peláez
Formula
This package can parse and evaluate formulas with variables., (*2)
It can take a string with a math expression and parses it so it can be evaluated replacing variables in the expression by given values., (*3)
The packages supports operations like addition, subtraction, multiplication and division., (*4)
The preferred way to install this extension is through composer., (*5)
Either run, (*6)
php composer.phar require --prefer-dist seregas/formula "*"
or add, (*7)
"seregas/formula": "*"
to the require section of your composer.json file., (*8)
Once the extension is installed, simply use it in your code by :, (*9)
$parser = new \socialist\formula\Formula('2 + 3 * 2,65 + 25 - 26');
$parser->calculate(); // 8.95
Also in the formula you can use variables:, (*10)
$parser = new \socialist\formula\Formula('2 + 3 * p + 25 - 26'); $parser->setVariable('p', 2,65); $parser->calculate(); // 8.95
And insert comments like /*...*/, [...] or {...}:, (*11)
$parser = new \socialist\formula\Formula('2 + 3 * p /* price */ + 25 - 26'); $parser->setVariable('p', 2,65); $parser->calculate(); // 8.95
Formula
GPL
Formul parser
GPL