Skip to the content
Documentation

prepend

No ratings yet

Summary

Returns the input array prepended with specified elements.

Usage

input|prepend( element1 [, element2 [, ... ] ] )

Parameters

Name Type Description Required
element1 any Element to be prepended to the input array. Yes.
element2 any Another element to be prepended to the input array. No.

Returns

An array consisting of the parameters and the input array.

Description

This operator adds the parameter value(s) to the start of the input array and returns the resulting array.

Examples

Example 1
{array( 4, 5 )|prepend( 1, 2, 3 )}

The following array will be returned: ( 1, 2, 3, 4, 5 ).

Changed in Exponential 6.0.15

The named parameters of the operator prepend in Exponential 6.0.15 (eZTemplateArrayOperator::namedParameterList(), lib/eztemplate/classes/eztemplatearrayoperator.php), by position:

Position 6.0.15 (name in the code) This page
1 prepend_string, required: No. element1, required: Yes.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.