sum() public method

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