function twig_join_filter in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/Extension/Core.php \twig_join_filter()
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>
Parameters
array $value An array:
string $glue The separator:
Return value
string The concatenated string
1 string reference to 'twig_join_filter'
- Twig_Extension_Core::getFilters in vendor/
Twig/ Extension/ Core.php - Returns a list of filters to add to the existing list.
File
- vendor/
Twig/ Extension/ Core.php, line 778
Code
function twig_join_filter($value, $glue = '') {
if ($value instanceof Traversable) {
$value = iterator_to_array($value, false);
}
return implode($glue, (array) $value);
}