如何更改数组的格式和求和值?

时间:2017-05-05 16:53:50

标签: php format

如果我有以下格式的数组:

Array (
    [0] => Array (
        [0] => Array (
            [count(*)] => 7
        )
    )
    [1] => Array (
        [0] => Array (
            [count(*)] => 1
        )
    )
    [2] => Array (
        [0] => Array (
            [count(*)] => 1
        )
    )
) 

如何以下列格式返回:

# What I need to capture into the new array:
# [count(*)] => 7 , [count(*)] => 1, [count(*)] => 1 
# So the values would be summed from the sub-arrays:
# 7+1+1 = 9
# The array would end up with just one value in it which is the sum
Array(
    [0] => 9
)

我只想获得该数组的总数,任何想法?

0 个答案:

没有答案