php-math-parser
所属分类:数值算法/人工智能
开发工具:PHP
文件大小:0KB
下载次数:0
上传日期:2022-12-15 14:55:41
上 传 者:
sh-1993
说明: 简单的数学表达式解析器和计算器。
(Simple mathematical expression parser and calculator.)
文件列表:
LICENSE (1083, 2022-12-15)
composer.json (578, 2022-12-15)
examples/ (0, 2022-12-15)
examples/examples.php (761, 2022-12-15)
src/ (0, 2022-12-15)
src/Math/ (0, 2022-12-15)
src/Math/Expression.php (3297, 2022-12-15)
src/Math/Lexer.php (2411, 2022-12-15)
src/Math/Operator.php (1980, 2022-12-15)
src/Math/Parser.php (3944, 2022-12-15)
src/Math/Token.php (1658, 2022-12-15)
src/Math/TranslationStrategy/ (0, 2022-12-15)
src/Math/TranslationStrategy/ShuntingYard.php (3386, 2022-12-15)
src/Math/TranslationStrategy/TranslationStrategyInterface.php (249, 2022-12-15)
tests/ (0, 2022-12-15)
tests/Math/ (0, 2022-12-15)
tests/Math/ExpressionTest.php (2269, 2022-12-15)
tests/Math/ParserTest.php (1475, 2022-12-15)
tests/bootstrap.php (141, 2022-12-15)
# Math
Simple mathematical expression parser and calculator.
## Install
The recommended way to install Math is [through composer](http://getcomposer.org).
```JSON
{
"require": {
"aboyadzhiev/php-math-parser": "dev-master"
}
}
```
## Usage
Here is simple example of evaluating math expression
```php
evaluate($expression);
echo $result; // 302
$expression = '-2+-2*13*(7*8)-(415-0.1)';
$result = $parser->evaluate($expression);
echo $result; // -1872.90
```
## TODO
- Add additional translation strategy
## License
MIT, see LICENSE.
近期下载者:
相关文件:
收藏者: