slice.php
Table of Contents
Functions
- slice() : string
- Extract a slice from an array.
Functions
slice()
Extract a slice from an array.
slice(mixed $anyArray, int $start, int|null $length) : string
This helper wraps the ArangoDB AQL function SLICE(anyArray, start, length)
which extracts a portion of an array starting from the specified index.
The length parameter is optional - if not provided, all elements from
the start position to the end are included.
Example AQL usage:
SLICE([1, 2, 3, 4, 5], 1, 2) // returns [2, 3]
SLICE([1, 2, 3, 4, 5], 2) // returns [3, 4, 5]
SLICE([1, 2, 3, 4, 5], 0, 3) // returns [1, 2, 3]
Parameters
- $anyArray : mixed
-
Array expression to slice.
- $start : int
-
Starting index (zero-based) for the slice.
- $length : int|null
-
Optional length of the slice (null = to end of array).
Tags
Return values
string —The formatted AQL expression.