search

Home  >  Q&A  >  body text

php数组里数值相加

里边的数值相加,用array_sum()不行,有最合适的办法吗

[
  {
    "number": "105"
  },
  {
    "number": "105"
  },
  {
    "number": "105"
  },
  {
    "number": "105"
  }
]
阿神阿神2822 days ago727

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-04-10 17:32:19

    echo array_sum(array_column($your_array, 'number'));

    reply
    0
  • Cancelreply