PHPackages                             anastasd/expression-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. anastasd/expression-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

anastasd/expression-parser
==========================

A PHP library for parsing arithmetic expressions and functions in different programming languages

v1.3.0(1y ago)59[1 issues](https://github.com/anastasd/expression-parser/issues)MITPHPPHP ^8.0

Since Oct 5Pushed 1y ago2 watchersCompare

[ Source](https://github.com/anastasd/expression-parser)[ Packagist](https://packagist.org/packages/anastasd/expression-parser)[ RSS](/packages/anastasd-expression-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Expression Parser
=================

[](#expression-parser)

A PHP library for parsing arithmetic expressions and functions in different programming languages

Installation
------------

[](#installation)

`composer require anastasd/expression-parser`

How can the Expression Parser help?
-----------------------------------

[](#how-can-the-expression-parser-help)

- If you need to run code that uses unsafe input, the parser ensures no harm is done to the server or other code.
- If the eval() function is unavailable on your server, the evaluator can replace it.
- If you want to restrict the input functions to a specific list, a custom-built parser can handle that for you.
- If you want to “translate” expressions written in other programming languages or even spreadsheet functions to PHP, the parser can do that.

Use cases
---------

[](#use-cases)

- An online spreadsheet application that uses backend evaluation of cell content;
- Any application that requires custom mathematical logic;
- and many more ...

Limitations
-----------

[](#limitations)

Unary operators are not available (yet), just binary.

Examples
--------

[](#examples)

```
