PHPackages                             phpmyadmin/simple-math - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpmyadmin/simple-math

Abandoned → [symfony/expression-language](/?search=symfony%2Fexpression-language)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

phpmyadmin/simple-math
======================

Simple math evaluator

0.2(9y ago)41131GPL-2.0+PHPPHP &gt;=5.4.0

Since Oct 12Pushed 8y ago6 watchersCompare

[ Source](https://github.com/phpmyadmin/simple-math)[ Packagist](https://packagist.org/packages/phpmyadmin/simple-math)[ Docs](https://github.com/phpmyadmin/simple-math)[ RSS](/packages/phpmyadmin-simple-math/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

SimpleMath
==========

[](#simplemath)

Simple math expression evaluator.

Please note that in most cases it's better to use [Symfony ExpressionLanguage Component](https://packagist.org/packages/symfony/expression-language) instead. It performs better and provides more features.

This repository will probably not receive any updates in future.

[![Build Status](https://camo.githubusercontent.com/4b2aafca879ad702f5aa3c38bf1dbd113ea7b4a4f99ead504541c19a9d237121/68747470733a2f2f7472617669732d63692e6f72672f7068706d7961646d696e2f73696d706c652d6d6174682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phpmyadmin/simple-math)[![codecov.io](https://camo.githubusercontent.com/7ad9a11e22524b3d1e785e8041a74ef9e980927f69abbc7c1983df9e238adbe2/68747470733a2f2f636f6465636f762e696f2f6769746875622f7068706d7961646d696e2f73696d706c652d6d6174682f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/phpmyadmin/simple-math?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/520745b744caa481bd49f91c8d1d215cec36f4180e616554c925f0799a3cf907/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068706d7961646d696e2f73696d706c652d6d6174682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/phpmyadmin/simple-math/?branch=master)[![Packagist](https://camo.githubusercontent.com/bc3c4388b83282885b5fd67d7ce0d2ee4b4dd79b43c832304893bab67e577b03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706d7961646d696e2f73696d706c652d6d6174682e737667)](https://packagist.org/packages/phpmyadmin/simple-math)

Features
--------

[](#features)

- Supports basic arithmetic operations `+`, `-`, `*`, `/`, `%`
- Supports parenthesis
- Supports right associative ternary operator
- Supports comparison operators `==`, `!=`, `>`, `=`, `evaluate('1 + 2');

// Evaluate expression with PHP style variable
$math->registerVariable('$a', 4);
$value = $math->evaluate('$a + 1');

// Evaluate expression with variable
$math->registerVariable('n', 4);
$value = $math->evaluate('n + 1');

// Calculate same expression with different values
$math = new SimpleMath\Math();

$math->parse('n + 1');

$math->registerVariable('n', 10);
$value = $math->run();

$math->registerVariable('n', 100);
$value = $math->run();
```

History
-------

[](#history)

This library is based on [Expressions.php gist](https://gist.github.com/dremie/fcb1f5beecc327679de8cca51c8e4743). It adds some functions, performance improvements and ability to install using [Composer](https://getcomposer.org/).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3504d ago

### Community

---

Top Contributors

[![nijel](https://avatars.githubusercontent.com/u/212189?v=4)](https://github.com/nijel "nijel (46 commits)")[![ircmaxell](https://avatars.githubusercontent.com/u/660654?v=4)](https://github.com/ircmaxell "ircmaxell (4 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![david-err](https://avatars.githubusercontent.com/u/13950685?v=4)](https://github.com/david-err "david-err (1 commits)")

### Embed Badge

![Health badge](/badges/phpmyadmin-simple-math/health.svg)

```
[![Health](https://phpackages.com/badges/phpmyadmin-simple-math/health.svg)](https://phpackages.com/packages/phpmyadmin-simple-math)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
