2017 © Pedro Peláez
 

library php-math-parser

Simple mathematical expression parser and calculator.

image

aboyadzhiev/php-math-parser

Simple mathematical expression parser and calculator.

  • Tuesday, April 12, 2016
  • by aboyadzhiev
  • Repository
  • 4 Watchers
  • 23 Stars
  • 6,818 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 1 Versions
  • 30 % Grown

The README.md

Math

Simple mathematical expression parser and calculator., (*1)

Install

The recommended way to install Math is through composer., (*2)

{
    "require": {
        "aboyadzhiev/php-math-parser": "dev-master"
    }
}

Usage

Here is simple example of evaluating math expression, (*3)

<?php

$parser = new \Math\Parser();
$expression = '1 + 2 * 3 * ( 7 * 8 ) - ( 45 - 10 )';
$result = $parser->evaluate($expression);

echo $result; // 302

$expression = '-2+-2*13*(7*8)-(415-0.1)';
$result = $parser->evaluate($expression);

echo $result; // -1872.90



TODO

  • Add additional translation strategy

License

MIT, see LICENSE., (*4)

The Versions

12/04 2016

dev-master

9999999-dev

Simple mathematical expression parser and calculator.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Adrean Boyadzhiev

math parser shunting-yard algorithm math calculator