PHPackages                             jamesgerat/exprlib - 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. jamesgerat/exprlib

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

jamesgerat/exprlib
==================

An expression parser in PHP

1.5.1(2y ago)02.8k—3.6%MITPHPPHP &gt;=7.3

Since Aug 19Pushed 2y agoCompare

[ Source](https://github.com/JamesGerat/exprlib)[ Packagist](https://packagist.org/packages/jamesgerat/exprlib)[ Docs](https://github.com/jamesgerat/exprlib)[ RSS](/packages/jamesgerat-exprlib/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

exprlib - PHP
=============

[](#exprlib---php)

[![Build Status](https://camo.githubusercontent.com/6dde83e80c6defbc1d32fe9f565c1115f33cf94ebc114f6a93de6eaf08e6317d/68747470733a2f2f6170692e7472617669732d63692e636f6d2f4a616d657347657261742f657870726c69622e737667)](https://travis-ci.com/github/JamesGerat/exprlib)

For migration from [thesoftwarefarm/exprlib](https://github.com/thesoftwarefarm/exprlib) and another fork need:

- replace var format from "{{a}}" to "\[a\]"
- up php to 7.3

An expression parser in PHP, code inspired from [codehackit](http://codehackit.blogspot.fr/2011/08/expression-parser-in-php.html)

An alternative to this is [Hoa/Math](https://github.com/hoaproject/Math)

List of functions and features:

- operators = \* + - ^ !=
- acos
- cos
- sin
- tan
- round
- pow
- sqrt
- log
- exp
- sum
- avg
- min
- max
- if (condition, than, else)
- var placing with \[varName\]

Examples:

```
