Oihana PHP Arango

split.php

Table of Contents

Functions

split()  : string
Split a string into an array using a separator.

Functions

split()

Split a string into an array using a separator.

split(string $value, string $separator[, int|null $limit = null ]) : string

This helper wraps the ArangoDB AQL function SPLIT(value, separator, limit) which splits the given string into an array of strings using the specified separator. You can optionally limit the number of splits.

Example AQL usage:

SPLIT("a,b,c", ",")           // returns ["a", "b", "c"]
SPLIT("hello world", " ")     // returns ["hello", "world"]
SPLIT("a,b,c", ",", 2)        // returns ["a", "b,c"] (limited to 2 parts)
SPLIT("hello", "")            // returns ["h", "e", "l", "l", "o"] (split by character)
Parameters
$value : string

String expression to split.

$separator : string

Separator string to split on.

$limit : int|null = null

Optional limit for number of splits.

Tags
example
use function oihana\arango\db\functions\strings\split;

$expr = split('doc.text', '","', null);
// Produces: 'SPLIT(doc.text, ",", )'
see
https://docs.arangodb.com/3.12/aql/functions/string/#split
concat()

For joining strings.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results