Joins the values to a string.
The separator between elements is an empty string per default, you can define it with the optional parameter.
<pre> {{ [1, 2, 3]|join('|') }} {# returns 1|2|3 #}
{{ [1, 2, 3]|join }} {# returns 123 #} </pre>
array $value An array:
string $glue The separator:
string The concatenated string
function twig_join_filter($value, $glue = '') {
if ($value instanceof Traversable) {
$value = iterator_to_array($value, false);
}
return implode($glue, (array) $value);
}