php数组里数值相加
程序员文章站
2023-12-28 09:43:46
...
里边的数值相加,用array_sum()不行,有最合适的办法吗
[
{
"number": "105"
},
{
"number": "105"
},
{
"number": "105"
},
{
"number": "105"
}
]
回复内容:
里边的数值相加,用array_sum()不行,有最合适的办法吗
[
{
"number": "105"
},
{
"number": "105"
},
{
"number": "105"
},
{
"number": "105"
}
]
echo array_sum(array_column($your_array, 'number'));