php foreach 二维数组的问题

数据库中查询出的结果是二维数组,然后foreach后出现以下结果
foreach:

foreach ($users as $k=>$v){
        var_dump($v);
}

结果:

  array(12) {["id"]=> string(1) "7" ["name"]=> string(9) "小红" ["province"]=> string(6) "四川"   ["activation"]=> int(5) ["money"]=> string(5) "25.00" ["count"]=> int(1000) ["total"]=> string(1) "4" ["coltd"]=> string(1) "2" ["station"]=> string(1) "0" ["totalMoney"]=> string(8) "13001.01" } 
  array(12) { ["id"]=> string(1) "9" ["name"]=> string(9) "蒋磊"  ["province"]=> string(6) "浙江"   ["activation"]=> int(10) ["money"]=> string(5) "50.00" ["count"]=> int(1000)["total"]=> string(1) "3" ["coltd"]=> string(1) "2" ["station"]=> string(1) "0" ["totalMoney"]=> string(4) "0.51" } 
  array(12) { ["id"]=> string(1) "3" ["name"]=> string(9) "魏天" ["province"]=> string(6) "天津"   ["activation"]=> int(0) ["money"]=> string(4) "0.00" ["count"]=> int(0) ["total"]=> string(1) "4" ["coltd"]=> string(1) "2" ["station"]=> string(1) "2" ["totalMoney"]=> string(4) "0.44" } 
  array(12) { ["id"]=> string(1) "1"  ["name"]=> string(9) "张小明"  ["province"]=> string(6) "广东"   ["activation"]=> int(1) ["money"]=> string(4) "5.00" ["count"]=> int(1000) ["total"]=> string(1) "1" ["coltd"]=> string(1) "2" ["station"]=> string(1) "0" ["totalMoney"]=> string(4) "0.04" } 
  array(12) { ["id"]=> string(2) "12" ["name"]=> string(9) "张小明"  ["province"]=> string(6) "湖北"   ["activation"]=> int(1) ["money"]=> string(4) "5.00" ["count"]=> int(1000) ["total"]=> string(1) "1" ["coltd"]=> string(1) "0" ["station"]=> string(1) "0" ["totalMoney"]=> string(4) "0.04" } 
  array(12) { ["id"]=> string(2) "26" ["name"]=> string(9) "张小明" ["province"]=> string(6) "北京"   ["activation"]=> int(1) ["money"]=> string(4) "5.00" ["count"]=> int(1000) ["total"]=> string(1) "1" ["coltd"]=> string(1) "0" ["station"]=> string(1) "7" ["totalMoney"]=> string(4) "0.04" } }

想得到的结果是:将名字【name】相同的人的对应的值相加,但是总的人数不变【数组的元素个数不变】。[例:张小明的数据, 将三个元素中的["activation"],["money"],["count"],["total"],["totalMoney"]的值相加]
想要得到以下的结果:

  array(12) { ["id"]=> string(1) "7" ["name"]=> string(9) "小红" ["province"]=> string(6) "四川"   ["activation"]=> int(5) ["money"]=> string(5) "25.00" ["count"]=> int(1000) ["total"]=> string(1) "4" ["coltd"]=> string(1) "2" ["station"]=> string(1) "0" ["totalMoney"]=> string(8) "13001.01" } 
  array(12) { ["id"]=> string(1) "9" ["name"]=> string(9) "蒋磊"  ["province"]=> string(6) "浙江"   ["activation"]=> int(10) ["money"]=> string(5) "50.00" ["count"]=> int(1000)["total"]=> string(1) "3" ["coltd"]=> string(1) "2" ["station"]=> string(1) "0" ["totalMoney"]=> string(4) "0.51" } 
  array(12) { ["id"]=> string(1) "3" ["name"]=> string(9) "魏天" ["province"]=> string(6) "天津"   ["activation"]=> int(0) ["money"]=> string(4) "0.00" ["count"]=> int(0) ["total"]=> string(1) "4" ["coltd"]=> string(1) "2" ["station"]=> string(1) "2" ["totalMoney"]=> string(4) "0.44" } 
  array(12) { ["id"]=> string(1) "1"  ["name"]=> string(9) "张小明"  ["province"]=> string(6) "广东"   ["activation"]=> int(3) ["money"]=> string(4) "15.00" ["count"]=> int(3000) ["total"]=> string(1) "3" ["coltd"]=> string(1) "2" ["station"]=> string(1) "0" ["totalMoney"]=> string(4) "0.12" } 
  array(12) { ["id"]=> string(2) "12" ["name"]=> string(9) "张小明"  ["province"]=> string(6) "湖北"   ["activation"]=> int(3) ["money"]=> string(4) "15.00" ["count"]=> int(3000) ["total"]=> string(1) "3" ["coltd"]=> string(1) "0" ["station"]=> string(1) "0" ["totalMoney"]=> string(4) "0.12" } 
  array(12) { ["id"]=> string(2) "26" ["name"]=> string(9) "张小明" ["province"]=> string(6) "北京"   ["activation"]=> int(3) ["money"]=> string(4) "15.00" ["count"]=> int(3000) ["total"]=> string(1) "3"  ["coltd"]=> string(1) "0" ["station"]=> string(1) "7" ["totalMoney"]=> string(4) "0.12" } }
查看回复