Oihana PHP Arango

range.php

Table of Contents

Functions

range()  : string
Return an array of numbers in the specified range.

Functions

range()

Return an array of numbers in the specified range.

range(int $start, int $stop[, float $step = 1.0 ]) : string

This helper wraps the ArangoDB AQL function RANGE(start, stop, step) which generates an array of numbers from start to stop (exclusive) with the specified step increment. The start and stop arguments are truncated to integers unless a step argument is provided.

Example AQL usage:

RANGE(1, 5)                   // returns [1, 2, 3, 4]
RANGE(0, 10, 2)               // returns [0, 2, 4, 6, 8]
RANGE(5, 1, -1)               // returns [5, 4, 3, 2]
RANGE(1, 1)                   // returns [] (empty array)
Parameters
$start : int

The starting value (inclusive).

$stop : int

The ending value (exclusive).

$step : float = 1.0

The step increment (default: 1.0).

Tags
example
use function oihana\arango\db\functions\numerics\range;

$expr = range(1, 5);
// Produces: 'RANGE(1, 5)'

$expr = range(0, 10, 2);
// Produces: 'RANGE(0, 10, 2)'
see
https://docs.arangodb.com/stable/aql/functions/numeric/#range
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results