01
Expressions that stay readable.
Write the calculation your users already understand. Variables, familiar operators, and a focused set of math functions.
See the grammar →A small, predictable expression evaluator for the moments when a calculator needs to live inside your application.
Write the calculation your users already understand. Variables, familiar operators, and a focused set of math functions.
See the grammar →Every failure has a stable code and source span, so validation messages can be useful instead of mysterious.
Explore error codes →Overflow, non-finite values, malformed input, and resource limits are handled explicitly and consistently.
View the limits →Keep the evaluator behind your own form, API, or rule editor. MathPHP does the careful part.
$result = Math::evaluate('2 * (3 + 4)');