length.php
Table of Contents
Functions
- length() : string
- Get the number of elements in an array, object, or collection.
Functions
length()
Get the number of elements in an array, object, or collection.
length(mixed $expression) : string
This helper wraps the ArangoDB AQL function LENGTH(expression) which returns
the number of elements in arrays, the number of attributes in objects, or
the number of documents in collections.
Example AQL usage:
LENGTH([1, 2, 3, 4]) // returns 4
LENGTH(doc.items) // returns number of items
LENGTH({a: 1, b: 2}) // returns 2 (object attributes)
LENGTH(collection) // returns number of documents
Parameters
- $expression : mixed
-
Array, object, or collection expression to measure.
Tags
Return values
string —The formatted AQL expression.