Join ViewHelper <f:join>
¶
The JoinViewHelper combines elements from an array into a single string. You can specify both a general separator and a special one for the last element, which serves as the delimiter between the elements.
Examples¶
Simple join¶
<f:join value="{0: '1', 1: '2', 2: '3'}" />
Copied!
123
Copied!
Join with separator¶
<f:join value="{0: '1', 1: '2', 2: '3'}" separator=", " />
Copied!
1, 2, 3
Copied!
Join with separator, and special one for the last¶
<f:join value="{0: '1', 1: '2', 2: '3'}" separator=", " separatorLast=" and " />
Copied!
1, 2 and 3
Copied!
Source code
Go to the source code of this ViewHelper: JoinViewHelper.php (GitHub).
Arguments
The following arguments are available for the join ViewHelper:
-
value
¶ -
- Type
- array
An array
-
separator
¶ -
- Type
- string
- Default
- ''
The separator
-
separatorLast
¶ -
- Type
- string
The separator for the last pair.