我想对所有 [Suggested] 字段求和.请问我该怎么做?我使用 PHP.
I'd like to make a sum of all [Suggested] field. How can I make it please? I use Php.
Array
(
[0] => Array
(
[Id] => 4
[Suggested] => 1322
[proximite_r] => 30924.8470655462
)
[1] => Array
(
[Id] => 7
[Suggested] => 773
[proximite_r] => 32229.1036975145
)
)
谢谢!
你可以试试这个:
$Sum = 0;
foreach ($row as $item) {
$Sum += $item['Suggested']; // or else index
}
echo $Sum;
这篇关于如何对这个数组求和?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!