lang/equation

A PHP formula parser based on bc_math

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/lang/equation

v0.0.2 2025-08-15 02:28 UTC

This package is auto-updated.

Last update: 2026-01-18 03:13:49 UTC


README

基于 bc_math 的 PHP 公式解析器

Install

$ composer install lang\equation

Simple examples

<?php

use Lang\Equation\Equation;

$expr = Equation::parse('1+1');
echo $expr->getValue();
// Output: 2

// With params
// !notice parameter name format: ':param_name:'
$expr2 = Equation::parse('2 + :var:');
echo $expr2->getValue(['var' => 2]);
// Output: 4

License

MIT license (© 2024 Lang)

Have fun with Equation