Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

implode

Summary

Joins array elements with strings.

Usage

input|implode( separator )

Parameters

NameTypeDescriptionRequired
separator string The string that should be inserted between the elements. Yes.

Returns

String containing array elements separated a string.

Description

This operator returns a string representation of the elements of the input array. Each element will be separated by the string specified using the "separator" parameter.

Examples

Example 1

{array( 1, 2, 3, 4, 5, 6, 7 )|implode( ', ' )}

The following string will be returned: "1, 2, 3, 4, 5, 6, 7".

Example 2

{array( 1, 2, 3, 4, 5, 6, 7 )|implode( '_-_' )}

The following string will be returned: "1_-_2_-_3_-_4_-_5_-_6_-_7".

Balazs Halasy (05/02/2004 9:32 am)

Balazs Halasy (06/06/2005 11:49 am)


Comments

  • Convert spaces in text to dashes

    {"This is some text"|explode(' ')|implode('-')|wash)}
    


    Returns
    "This-is-some-text"