2017 © Pedro Peláez
 

library formula

Formula

image

seregas/formula

Formula

  • Wednesday, August 30, 2017
  • by socialist
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

formula

Latest Stable Version Build Status Total Downloads, (*1)

This package can parse and evaluate formulas with variables., (*2)

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., (*3)

The packages supports operations like addition, subtraction, multiplication and division., (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

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

or add, (*7)

"seregas/formula": "*"

to the require section of your composer.json file., (*8)

Usage

Once the extension is installed, simply use it in your code by :, (*9)

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

Also in the formula you can use variables:, (*10)


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

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


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

The Versions

30/08 2017

dev-master

9999999-dev

Formula

  Sources   Download

GPL

The Requires

  • php ^7.0

 

The Development Requires

by Social IST

30/10 2016

0.1.0

0.1.0.0

Formul parser

  Sources   Download

GPL

The Requires

  • php ^7.0

 

The Development Requires

by Social IST