Skip to the content
Documentation

array_sum

No ratings yet

Summary

Returns the sum of all elements in an array.

Usage

input|array_sum()

Returns

An integer representing the sum of the elements.

Description

This operator attempts to calculate and return the sum of the input array's elements.

Examples

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

The following output will be produced: "28" - which is the sum of 1, 2, 3, 4, 5, 6, 7.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.