You are here

function ctools_math_expr_if in Chaos Tool Suite (ctools) 7

Helper function for evaluating 'if' condition.

Parameters

int $expr: The expression to test: if <> 0 then the $if expression is returned.

mixed $if: The expression returned if the condition is true.

mixed $else: Optional. The expression returned if the expression is false.

Return value

mixed|null The result. NULL is returned when an If condition is False and no Else expression is provided.

1 string reference to 'ctools_math_expr_if'
ctools_math_expr::__construct in includes/math-expr.inc
Public constructor.

File

includes/math-expr.inc, line 907
=============================================================================.

Code

function ctools_math_expr_if($expr, $if, $else = NULL) {
  return $expr ? $if : $else;
}