Oihana PHP Arango

reverse.php

Table of Contents

Functions

reverse()  : string
Reverse the elements of an array or characters in a string.

Functions

reverse()

Reverse the elements of an array or characters in a string.

reverse(mixed $anyArray) : string

This helper wraps the ArangoDB AQL function REVERSE(expression) which can reverse both arrays and strings. For arrays, it reverses the order of elements. For strings, it reverses the order of characters.

Example AQL usage:

REVERSE([1, 2, 3])          // returns [3, 2, 1]
REVERSE("hello")            // returns "olleh"
REVERSE(doc.items)          // reverses the order of items
Parameters
$anyArray : mixed

Array or string expression to reverse.

Tags
example
use function oihana\arango\db\functions\arrays\reverse;

$expr = reverse('[1, 2, 3]');
// Produces: 'REVERSE([1, 2, 3])'

$expr = reverse('"hello"');
// Produces: 'REVERSE("hello")'
see
https://docs.arangodb.com/stable/aql/functions/array/#reverse
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results