Skip to content

zhuravljov/calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Calculator

Library for the calculation of simple math expressions without using eval().

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require zhuravljov/calc

or add

"zhuravljov/calc": "*"

to the require section of your composer.json file.

Usage

$calculator = new \zhuravljov\calc\Calculator();
$calculator->calc('2 + 2 * 2'); // 6
$calculator->calc('(2 + 2) * 2'); // 8
$calculator->calc('(2 + 2'); // CalcException

Available operations +, -, * and /.

About

Library for the calculation of simple math expressions

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages