Dynamic logical expression parsing/evaluation in PHP?

前端 未结 6 503
隐瞒了意图╮
隐瞒了意图╮ 2021-01-11 14:10

I have a need to evaluate user-defined logical expressions of arbitrary complexity on some PHP pages. Assuming that form fields are the primary variables, it would need to:

6条回答
  •  余生分开走
    2021-01-11 14:48

    Much time has gone by since this question was asked, and I happened to be looking for an expression parser for php. I chose to use the ExpressionLanguage component from Symfony 2.4. It can be installed with no dependencies from composer via packagist.

    composer require symfony/expression-language

提交回复
热议问题