Arithmetic Parser
Simple interpreter of arithmetic expressions
Usage
Simple arithmetic operations with operation priority
<?php
//1.0
$result = \App\Interpreter::evaluate('(1.0 + 2.0 * 3.0 / ( 6.0*6.0 + 5.0*44.0)) - 0.0234375');
?>
Simple functions such as sqrt (also supported cos,sin,tan)
<?php
//2.0
$result = \App\Interpreter::evaluate('sqrt(4)');
//3.0
$result = \App\Interpreter::evaluate('sqrt(2+2*2+3)');
?>
Power operator
<?php
//32
$result = \App\Interpreter::evaluate('2**5');
//32
$result = \App\Interpreter::evaluate('2^5');
//36
$result = \App\Interpreter::evaluate('(2+2*2)^2');
?>