PHPackages                             conclusivesystems/eval-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. conclusivesystems/eval-math

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

conclusivesystems/eval-math
===========================

EvalMath

1.0.2(1y ago)1827↓71.4%PHPPHP &gt;=5.3

Since Apr 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/conclusivesystems/eval-math)[ Packagist](https://packagist.org/packages/conclusivesystems/eval-math)[ RSS](/packages/conclusivesystems-eval-math/feed)WikiDiscussions master Synced 3d ago

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

Composer/Packagist version of EvalMath originally by Miles Kaufman Copyright (C) 2005 Miles Kaufmann

This version contains improvements from moodle.

NAME
----

[](#name)

```
EvalMath - safely evaluate math expressions

```

DESCRIPTION
-----------

[](#description)

```
Use the EvalMath class when you want to evaluate mathematical expressions
from untrusted sources.  You can define your own variables and functions,
which are stored in the object.  Try it, it's fun!

```

SYNOPSIS
--------

[](#synopsis)

```
`$m = new EvalMath;`

`// basic evaluation:`
`$result = $m->evaluate('2+2');`

`// supports: order of operation; parentheses; negation; built-in functions`
`$result = $m->evaluate('-8(5/2)^2*(1-sqrt(4))-8');`

`// create your own variables`
`$m->evaluate('a = e^(ln(pi))');`

`// or functions`
`$m->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1');`

`// and then use them`
`$result = $m->evaluate('3*f(42,a)');`

```

METHODS
-------

[](#methods)

```
`$m->evaluate($expr)`
    Evaluates the expression and returns the result.  If an error occurs,
    prints a warning and returns false.  If $expr is a function assignment,
    returns true on success.

`$m->e($expr)`
    A synonym for $m->evaluate().

`$m->vars()`
    Returns an associative array of all user-defined variables and values.

`$m->funcs()`
    Returns an array of all user-defined functions.

```

PARAMETERS
----------

[](#parameters)

```
`$m->suppress_errors`
    Set to true to turn off warnings when evaluating expressions

`$m->last_error`
    If the last evaluation failed, contains a string describing the error.
    (Useful when suppress_errors is on).

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1356 days

Total

3

Last Release

649d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7bc98f8f98cf78bc7636ae80b4491f2f15fccfb9fd3fd36f2b77f1520f1b5e99?d=identicon)[KualiCoSaaSOps](/maintainers/KualiCoSaaSOps)

---

Top Contributors

[![rockyjvec](https://avatars.githubusercontent.com/u/8481561?v=4)](https://github.com/rockyjvec "rockyjvec (1 commits)")

---

Tags

EvalMath

### Embed Badge

![Health badge](/badges/conclusivesystems-eval-math/health.svg)

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

###  Alternatives

[webit/eval-math

EvalMath

28926.7k8](/packages/webit-eval-math)

PHPackages © 2026

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