Core Function SumValues

From Sputnik Wiki
Jump to: navigation, search
SumValues( <array> )

Contents

Description

Counts the sum total of all the values of an array.

Parameters

array

The array to use.

Return Value

Success: Returns the sum of values

Failure: 0

Remarks

This is recursive and it will collect the sum from all additional arrays contained every array it finds.

Example

$a = array(2, 4, 6, 8);
say ("sum(a) = " . SumValues($a)); // 20
 
$b = array("a" => 1.2, "b" => 2.3, "c" => 3.4);
say ("sum(b) = " . SumValues($b)); // 6.9
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox