sum() public méthode

Get the sum of all elements inside the array.
public sum ( ) : number
Résultat number The sum of all elements from within the current array.
Exemple #1
0
 public function testSum()
 {
     $a = new ArrayObject([1, 2, 3]);
     $sum = $a->sum();
     $this->assertSame(6, $sum);
 }