extract

Summary

Extracts a portion from an array.

Usage

$input_array|extract( $offset [, $length ] )

Parameters

NameTypeDescriptionRequired
offset integer Offset of array extraction yes
length integer Number of elements to extract no

Returns

New array containing extracted elements.

Description

The extract operator will return a portion of an inputted array. The returned portion is defined by the offset and length parameters. If length is omitted, the rest of the array (from offset) will be returned.

Examples

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

returns the array( 3, 4, 5, 6, 7 ).

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

returns the array( 4, 5, 6 ).

Comments

log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
       array_sum
       append
       array
       array_append
       array_merge
       array_prepend
       begins_with
       compare
       contains
       ends_with
       explode
       extract
       extract_left
       extract_right
       hash
       implode
       insert
       merge
       prepend
       remove
       repeat
       reverse
       array_sum
       unique
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
    URLs
    Variables
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
10:31:26 am
by Balazs Halasy

Last updated

05/02/2004
12:05:24 pm
by Kåre Køhler Høvik

Authors

Balazs Halasy
Kåre Køhler Høvik



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.