• PHP Video Tutorials

PHP - Ds Set sum() Function



Ds\Set::sum() function can return the sum of all values in a set.

Syntax

public number Ds\Set::sum( void )

Ds\Set::sum() function doesn't have any parameters.

Ds\Set::sum() function can return the sum of all values in a set as either float or int depending on values in a set.

Example

<?php
   $set = new \Ds\Set([1, 2, 3, 4, 5, 6]); 
   
   echo("The sum of all values:");  
   print_r($set->sum());  
?> 
php_function_reference.htm
Advertisements