PHP Programing language

array_sum() Function in PHP
Previous Home Next

array_sum()

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

Syntax:
array_sum(array)

In above syntax, "array" specifies an array.

Example:

<?php
$arr=array("A"=>97.2,"B"=>1.7,"C"=>9.6);
echo array_sum($arr);
?>

Output:

108.5

Previous Home Next