ternary.php
Table of Contents
Functions
- ternary() : string
- Builds a ternary AQL (or general) expression as a string.
Functions
ternary()
Builds a ternary AQL (or general) expression as a string.
ternary(string $condition[, mixed|null $trueValue = null ][, mixed|null $falseValue = null ]) : string
Generates a string in the format:
condition ? trueValue : falseValue
The ternary operator evaluates the $condition:
- If
$conditionis true, the result is$trueValue. - Otherwise, the result is
$falseValue.
This is useful for dynamically constructing AQL expressions with conditional logic.
Parameters
- $condition : string
-
Boolean expression to evaluate (e.g., "IS_ARRAY(doc.tags)").
- $trueValue : mixed|null = null
-
Value or expression returned if the condition is true.
- $falseValue : mixed|null = null
-
Value or expression returned if the condition is false.
Tags
Return values
string —The assembled ternary expression as a string.