php8.5
Home/ Manual/ ds / deque/ Ds\Deque::join

Ds\Deque::join

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Joins all values together as a string

Description

Ds\Deque::join([string $glue]): string

Joins all values together as a string using an optional separator between each value.

Parameters

glue

An optional string to separate each value.

Return Values

All values of the deque joined together as a string.

Examples

Ds\Deque::join() example using a separator string

php
<?php
$deque = new \Ds\Deque(["a", "b", "c", 1, 2, 3]);

var_dump($deque->join("|"));
?>

The above example will output something similar to:

output
string(11) "a|b|c|1|2|3"

Ds\Deque::join() example without a separator string

php
<?php
$deque = new \Ds\Deque(["a", "b", "c", 1, 2, 3]);

var_dump($deque->join());
?>

The above example will output something similar to:

output
string(11) "abc123"

Source: reference/ds/ds/deque/join.xml · from the official PHP manual (php/doc-en)