GravityMath_Engine
Wrapper for the Hoa Math package
See Also
Source: includes/class-gravitymath-engine.php:10
Details
- Kind:
class - Namespace:
(global)
Properties
| Property | Type | Description |
|---|---|---|
$instance | GravityMath_Engine |
Methods
| Method | Description |
|---|---|
get_instance() | Get the instance of the class. |
result() | Parse and evaluate an expression. |
result_or_fallback() | Parses and evaluates an expression, and when that fails, the expression $fallback returns instead. |
Method Reference
get_instance()
public static function get_instance()
Get the instance of the class.
Returns
Since: 2.5.0
Source: includes/class-gravitymath-engine.php:39
result()
function result( $expression='' )
Parse and evaluate an expression.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$expression | string | '' | The expression to evaluate. |
Returns
float|string
Since: 1.0
Source: includes/class-gravitymath-engine.php:80
result_or_fallback()
public function result_or_fallback( $expression, callable $fallback )
Parses and evaluates an expression, and when that fails, the expression $fallback returns instead.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$expression | string | The expression to evaluate. | |
$fallback | callable | Returns the expression to try when $expression fails. Only called then. |
Returns
float|string
Throws
Throwable— The error from$expressionwhen both fail.
Since: 2.14.0
Source: includes/class-gravitymath-engine.php:102