dolibarr 20.0.0
EvalMath Class Reference

Class EvalMath. More...

Public Member Functions

 __construct ()
 Constructor.
 
 e ($expr)
 Evaluate.
 
 evaluate ($expr)
 Evaluate.
 
 vars ()
 Function vars.
 
 trigger ($code, $msg, $info=null)
 trigger an error, but nicely, if need be
 

Private Member Functions

 funcs ()
 Function funcs.
 
 nfx ($expr)
 Convert infix to postfix notation.
 
 pfx ($tokens, $vars=array())
 Evaluate postfix notation.
 

Detailed Description

Class EvalMath.

Definition at line 97 of file evalmath.class.php.

Member Function Documentation

◆ e()

EvalMath::e ( $expr)

Evaluate.

Parameters
string$exprString
Returns
boolean|int|float|NULL|mixed Result

Definition at line 134 of file evalmath.class.php.

References evaluate().

◆ evaluate()

EvalMath::evaluate ( $expr)

Evaluate.

Parameters
string$exprString
Returns
boolean|int|float|NULL|mixed Result

Definition at line 145 of file evalmath.class.php.

References nfx(), pfx(), and trigger().

Referenced by e().

◆ funcs()

EvalMath::funcs ( )
private

Function funcs.

Returns
array Output

Definition at line 217 of file evalmath.class.php.

◆ nfx()

EvalMath::nfx ( $expr)
private

Convert infix to postfix notation.

Parameters
string$exprExpression
Returns
boolean|array Output

Definition at line 234 of file evalmath.class.php.

References trigger().

Referenced by evaluate().

◆ pfx()

EvalMath::pfx ( $tokens,
$vars = array() )
private

Evaluate postfix notation.

Parameters
array$tokensExpression
array$varsArray
Returns
string|false Output or false if error

Definition at line 380 of file evalmath.class.php.

References pfx(), and trigger().

Referenced by evaluate(), and pfx().

◆ trigger()

EvalMath::trigger ( $code,
$msg,
$info = null )

trigger an error, but nicely, if need be

Parameters
string$codeCode
string$msgMsg
string | null$infoString
Returns
false

Definition at line 468 of file evalmath.class.php.

Referenced by evaluate(), nfx(), and pfx().

◆ vars()

EvalMath::vars ( )

Function vars.

Returns
array Output

Definition at line 204 of file evalmath.class.php.


The documentation for this class was generated from the following file: