IMPORTANT NOTE: First and last Release.
By DreamVB
Converted to PHP by HACKPRO TM (C) 2008-2009
Versión: 1.0
All rights reserved
@author Heriberto Mantilla Santamaría
@version 1.0
Description | Operator | Uses |
Addition |
+ |
Expr + Expr |
Subtraction |
- |
Expr - Expr |
Multiplication |
* |
Expr * Expr |
Division |
/ |
Expr / Expr |
Modulus |
% |
Expr % Expr |
Parenthesis |
() |
(Expr) |
Unary + |
+ |
+(Expr) |
Unary - |
- |
-(Expr) |
Assign |
= |
Var = expr |
Equals |
= |
Expr = Expr |
Bitwise AND |
&& |
Expr && Expr |
Bitwise OR |
|| |
Expr || Expr |
Description | Operator | Uses |
Bitwise AND |
AND |
Expr AND Expr |
Bitwise OR |
OR |
Expr OR Expr |
Bitwise XOR |
XOR |
Expr XOR Expr |
Shift Left |
SHL |
Expr SHL Expr |
Shift Right |
SHR |
Expr SHR Expr |
Integer Division |
DIV |
Expr DIV Expr |
Bitwise Not |
NOT |
Not Expr |
Modulus |
MOD |
Expr MOD Expr |
Description | Operator | Uses |
Shift Left |
<< |
Expr << Expr |
Shift Right |
>> |
Expr >> Expr |
ABS |
expr |
ATN |
expr |
COS |
expr |
EXP |
expr |
LOG |
expr |
RND |
expr |
ROUND |
expr |
SGN |
expr |
SIN |
expr |
SQR |
expr |
TAN |
expr |
SUM |
exprList Separated with a comma. |
IFF |
Truepart, Falsepart, Expression. |
E = 2.71828182845905
require_once('./lexmath.php');
$lex = new LexMath();
echo $lex->Calc('2 + 2 * (5 + 5)', true);
echo $lex->Calc('8+1/7*4+(9*4+1*(2+8))*6', true);
echo $lex->Calc('15 MOD 2', true);
echo $lex->Calc('2 ^ 2', true);
echo $lex->Calc('15 % 2', true);
echo $lex->Calc('(-5 + 3)', true);
echo $lex->Calc('(-5 + 3) / -5 * (-2.5) + 6', true);
echo $lex->Calc('PI', true);
echo $lex->Calc('E', true);