Core Function SumValues

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> SumValues( <array> ) </pre> === Description === Counts the sum total of all the values of an array. === Parameters === ==== array ==== The array to use. === Return V...")
 
m (1 revision)

Revision as of 21:41, 11 August 2014

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