承接 prot1vogas/expression-parser 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

prot1vogas/expression-parser

Composer 安装命令:

composer require prot1vogas/expression-parser

包简介

Simple expression parser

README 文档

README

pipeline status

Simple expression parser.

Compatible with PHP 5.4 and up.

Basic usage

$parser = new Parser(new TokenTypesFactory(), new Lexer());
$evaluator = new Evaluator();
$expression = $parser->parse("2 + 2");
echo $evaluator->execute($expression);

Features

  • binary operations + - * / % ^
  • unary operations - sqrt ! sin cos tan
  • brackets
  • float variables
  • constants pi, e

You can override TokenTypesFactory to add custom operations, variables or brackets. There are some classes of token types:

  • BinaryOperation
  • UnaryOperation
  • Variable
  • Brackets

For example, new operation 'func' may be added in method getUnaryOperations like this:

$operations[] = new UnaryOperation('func', function ($args) {
    return $args[0] / 2;
}, 15, UnaryOperation::PREFIX_NOTATION);

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固