Skip to main content

Join array items

Anatomy

<array:join var="var" var_result="var" delimiter="string" key="string"/>

Description: ARRAY:JOIN joins the items of an array together to form a string representation with each value separated by a given delimiter.

A given key may specify the column of a multidimensional array to join by. If however, the key is omitted, then the array is treated as an unidimensional list.

Attention:

If a key is specified and that key does not exist within the inner array, the corresponding item of the outer array will be skipped.

Attributes

NameTypeDescriptionDefined By
varvarVariable name array:join
var_resultvarResult variable name array:join
delimiterstringDelimiter array:join

Multidimensional

NameTypeDescriptionDefined By
keystringKey array:join

Results:

BindingTypePredicate
var_resultstringN/A

Examples

Example

<array var="names">
<item>Bill Gates</item>
<item>Steve Jobs</item>
<item>Larry Ellison</item>
</array>

<output>
<array:join var="names" delimiter=", "/>
</output>

<!-- Bill Gates, Steve Jobs, Larry Ellison -->