removeValue.php
Table of Contents
Functions
- removeValue() : string
- Remove all occurrences of a value from an array.
Functions
removeValue()
Remove all occurrences of a value from an array.
removeValue(string $anyArray, mixed $value[, int|string|null $limit = null ]) : string
This helper wraps the ArangoDB AQL function REMOVE_VALUE(anyArray, value, limit)
which removes all occurrences of a specified value from an array. An optional
limit can be specified to limit the number of removals.
Example AQL usage:
REMOVE_VALUE([1, 2, 3, 2, 4], 2) // returns [1, 3, 4]
REMOVE_VALUE([1, 2, 3, 2, 4], 2, 1) // returns [1, 3, 2, 4] (only first occurrence)
REMOVE_VALUE([1, 2, 3], 5) // returns [1, 2, 3] (value not found)
Parameters
- $anyArray : string
-
Array expression to remove value from.
- $value : mixed
-
Value to remove from the array.
- $limit : int|string|null = null
-
Optional limit for the number of removals. Non-numeric or non-positive values (and null) are ignored (no limit).
Tags
Return values
string —The formatted AQL expression.