lang/equation

v0.0.1 2024-08-14 12:44 UTC

This package is not auto-updated.

Last update: 2025-07-07 05:22:06 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