|
|
Php Array Elements Sum Function
|
Tutorials » Php »
|
Topic |
What is array_sum Function?
|
|
Explanation |
|
The "array_sum" function is used calculate the sum of element values in an array.
Syntax:
array_sum(array)
In the above syntax "array" specifies the array, for which to calculate the sum of values.
Example:
<?php
$a=array(0=>"10",1=>"20",2=>"30");
print_r(array_sum($a));
?>
Result:
60
In the above example the function calculates the sum of the array "$a" values, returns the sum as 60.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|