英[sʌm] 美[sʌm]

n.Amount; total; arithmetic; outline, key points

vt.& vi.Summary; total; summary, summary

Third person singular: sums Plural: sums Present participle: summing Past tense: summed Past participle: summed

php array_sum() function syntax

Function: Return the sum of all values ​​in the array

Syntax: array_sum(arra)

Parameters:

ParametersDescription
array Required. Specifies an array.

Description: If all values ​​are integers, return an integer value. If one or more of the values ​​is a floating point number, a floating point number is returned.

php array_sum() function example

<?php
$a=array("口红"=>199,"粉底"=>349,"眼影"=>99);
echo array_sum($a);
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

647
<?php
$arr = array('蚂蚁花呗要还' => 578,'蚂蚁借呗要还' => 1500, '网上银行要还' => 2000);
echo "那么你这个月要还".array_sum($arr);
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

那么你这个月要还4078