toBool.php
Table of Contents
Functions
- toBool() : string
- Converts a value of any type into a boolean.
Functions
toBool()
Converts a value of any type into a boolean.
toBool(mixed $value) : string
This helper wraps the ArangoDB AQL function TO_BOOL(), which casts
the provided value to a boolean. The conversion rules follow AQL semantics:
- Non-zero numbers and non-empty strings evaluate to
true. - Zero, empty strings,
null, and empty arrays evaluate tofalse.
Example AQL usage:
TO_BOOL(doc.isActive) // converts doc.isActive to boolean
TO_BOOL("") // returns false
TO_BOOL(1) // returns true
Parameters
- $value : mixed
-
The AQL field or expression to convert to boolean.
Tags
Return values
string —The formatted AQL expression (e.g., 'TO_BOOL(doc.isActive)').