ez.no / exponential / documentation / reference / template operators / mathematics / sum
$input_number|sum( value [,...] )
| Name | Type | Description | Required |
|---|---|---|---|
| value | number | Value to be added to the result. | Only if input parameter is omitted. |
| ... |
Number (sum of all parameters + input).
This operator simply adds up all the parameters (including the input parameter, if it is used) and returns the result.
Note: From 3.4 you can no longer send arrays as input value to this operator, the input value and parameters must all be scalar values. Use array_sum instead if you need this functionality.
Example 1
{sum( 1, 2, 3)}
returns 6.
Example 2
{1|sum( 2, 3, 4)}
returns 10.
Example 3
{let a=1 b=2 c=3} {$a|sum( $b, $c )} {/let}
returns 6.
log in or create a user account to comment.
Comments