Home  >  Article  >  php教程  >  If you encounter a two-dimensional array and want to get the sum of a certain field

If you encounter a two-dimensional array and want to get the sum of a certain field

WBOY
WBOYOriginal
2016-09-03 00:00:421155browse

array_sum(array_column($attr, 'field'));

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn