Skip to main content

concat

Note

This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information.

Returns a Vector that is the concatenation of the values of the current Map and the values of the provided Traversable

public function concat<Tu super Tv>(
Traversable<Tu> $traversable,
): Vector<Tu>;

The provided Traversable is concatenated to the end of the current Map to produce the returned Vector.

Guide

Parameters

Returns

Examples

This example creates new Vectors by concatenating the values in a Map with Traversables:

$m = Map {
'red' => '#ff0000',
};

// Create a Vector by concating the values from $m with a Set
$v1 = $m->concat(Set {'#00ff00', '#0000ff'});

// Create a Vector by concating the values from $m with a Vector
$v2 = $m->concat(Vector {'#ffff00', '#663399'});

\var_dump($m->values()); // $m contains the value '#ff0000'
\var_dump($v1); // $v1 contains '#ff0000', '#00ff00', '#0000ff'
\var_dump($v2); // $v2 contains '#ff0000', '#ffff00', '#663399'