Arrays

These documentation pages are no longer maintained. Please visit the new documentation site.

The following table contains a list of template operators related to arrays and array handling. Click on the name of an operator for more information about that specific operator (usage, parameters, description, examplets, etc.).

Operator Description
array_sumReturns the sum of all elements in an array
appendAppends element(s) to an array.
arrayBuilds an array using specified elements.
array_appendDEPRECATED - use "append" instead.
array_mergeDEPRECATED - use "merge" instead
array_prependDEPRECATED - use "prepend" instead
begins_withChecks if an array starts with a specific element/sequence.
compareCompares the contents of two arrays.
containsChecks if an array contains a specific element.
ends_withChecks if an array ends with a specific element/sequence.
explodeSplits an array into an array of subarrays.
extractExtracts a portion from an array.
extract_leftExtracts a portion from the start of an array.
extract_rightExtracts a portion from the end of an array.
hashCreates a hash (associative array).
implodeJoins array elements with strings.
insertInserts an element/sequence at specified position in array.
mergeMerges input and passed arrays into one array.
prependAdds element(s) to start of an array.
removeRemoves element(s) from an array.
repeatRepeats the contents of an array.
reverseReverses the contents of an array.
array_sumCalculates the sum of values in an array.
uniqueRemoves duplicate values from an array.

Comments

Custom operators

Is there any "sort" function for arrays?

I especially miss PHP's "natsort(array)"...

array|count

I was looking for that function too. Why is'nt it on this list??

Finding the number of elements in an array

Since I just spent 20 minutes looking for this:

{$array|count}

will return the number of elements in the array.

It's documented in http://ez.no/ez_publish/documenta...ference/template_operators/variables

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:19:41 am
by Balazs Halasy

Last updated

05/02/2004
3:53:54 pm
by Balazs Halasy

Authors

Balazs Halasy



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