PHP array_sum() Function

Definition and Usage

The array_sum() function returns the sum of all the values in the array.

Syntax

array_sum(array)

Parameter Description
array Required. Specifies an array


Example

<?php
$a=array(0=>"5",1=>"15",2=>"25");
echo array_sum($a);
?> 
 
OUTPUT :
45