承接 seregas/formula 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

seregas/formula

最新稳定版本:0.3.0

Composer 安装命令:

composer require seregas/formula

包简介

Formula

README 文档

README

Latest Stable Version Build Status Total Downloads

This package can parse and evaluate formulas with variables.

It can take a string with a math expression and parses it so it can be evaluated replacing variables in the expression by given values.

The packages supports operations like addition, subtraction, multiplication and division.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist seregas/formula "*" 

or add

"seregas/formula": "*" 

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

$parser = new \socialist\formula\Formula('2 + 3 * 2,65 + 25 - 26'); $parser->calculate(); // 8.95

Also in the formula you can use variables:

$parser = new \socialist\formula\Formula('2 + 3 * p + 25 - 26'); $parser->setVariable('p', 2,65); $parser->calculate(); // 8.95

And insert comments like /*...*/, [...] or {...}:

$parser = new \socialist\formula\Formula('2 + 3 * p /* price */ + 25 - 26'); $parser->setVariable('p', 2,65); $parser->calculate(); // 8.95

统计信息

  • 总下载量: 42.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固