我有这样的数组:
array(2)(
['id'] => "59898441545",
['total'] =>
array(
[0] => 2,
[1] => 5
[2] => 10
[3] => 35
)
);
Run Code Online (Sandbox Code Playgroud)
我希望返回的数组是相同的,但关键的"总数"不是aarray,而是所有的precedemtn值的总和,如下所示:
array(2)(
['id] => "59898441545",
['total'] => 52 // the sum of the precedent elements
);
Run Code Online (Sandbox Code Playgroud)
PS:"总数组"中的元素数量可能会改变任何帮助?thx提前