mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-09 02:30:55 +02:00
* Implemented support for substr, implode and json_encode as modifiers. Fixes #939 * Added split and join in favor of explode and implode modifiers. * Documented all available modifiers
26 lines
690 B
Markdown
26 lines
690 B
Markdown
# join
|
|
|
|
Returns a string containing all the element of the given array
|
|
with the separator string between each.
|
|
|
|
## Basic usage
|
|
|
|
For `$myArray` populated with `['a','b','c']`, the following will return the string `abc`.
|
|
```smarty
|
|
{$myArray|join}
|
|
```
|
|
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|--------|----------|-------------------------------------------------------------|
|
|
| 1 | string | No | glue used between array elements. Defaults to empty string. |
|
|
|
|
## Examples
|
|
|
|
|
|
For `$myArray` populated with `[1,2,3]`, the following will return the string `1-2-3`.
|
|
```smarty
|
|
{$myArray|join:"-"}
|
|
``` |