当前位置:Gxlcms > PHP教程 > php数组里数值相加

php数组里数值相加

时间:2021-07-01 10:21:17 帮助过:26人阅读

里边的数值相加,用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'));

人气教程排行