Home > SimpleCalc

SimpleCalc

SimpleCalc is a project mainly written in PHP, it's free.

PHP Class to calculate simple mathematical expressions in infix notation

class.SimpleCalc.php PHP SimpleCalc Class

Copyright (C) 2011 Vladimir Shugaev

Class executes simple mathematical calculations with expression in infix notation Curently allows simple algebraic binary operations:

  • addition (+)
  • substraction (-)
  • multiplication (*)
  • division (/)
  • exponential (^)

It also allows to use braces and watchs for priority of operations

Usage

require_once "class.SimpleCalc.php";
$calc=new SimpleCalc();
echo $calc->calculate ('3+2-1/3^2-15*1+(2+3-(3*2)^2)');
Previous:HelloWorld