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

remove

Summary

Returns the input array without some of the original elements.

Usage

input|remove( offset [, length ] )

Parameters

NameTypeDescriptionRequired
offset integer The offset to start removing elements. Yes.
length integer The number of elements that should be removed. No.

Returns

A cut-down version of the input array.

Description

This operator removes element(s) from the input array and thus a chopped/cut-down version of the input array will be returned. The "offset" parameter must be used to define the start of the portion that should be removed. The "length" parameter can be used to define the number of elements that should be removed. If the "length" parameter is omitted, only one elemen (specified by offset will be removed).

Examples

Example 1

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

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

Example 2

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

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

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

Balazs Halasy (14/12/2005 3:32 pm)


Comments

  • bug: if the length parameter is omitted, the rest of the array is removed

    Fixed in
    3.6.11 (stable/3.6 rev. 16623),
    3.7.9 (stable/3.7 rev. 16622),
    3.8.4 (stable/3.8 rev. 16621),
    3.9.0alpha1 (trunk rev. 16620).