Array
(
[0] => Array
(
[id] => 1
[member_id] => 8
[total] => 5
[mainroomid] => 2
)
[1] => Array
(
[id] => 2
[member_id] => 11
[total] => 2
[mainroomid] => 2
)
[2] => Array
(
[id] => 3
[member_id] => 8
[total] => 8
[mainroomid] => 2
)
[3] => Array
(
[id] => 4
[member_id] => 11
[total] => 3
[mainroomid] => 2
)
[4] => Array
(
[id] => 5
[member_id] => 29
[total] => 4
[mainroomid] => 2
)
[5] => Array
(
[id] => 6
[member_id] => 8
[total] => 5
[mainroomid] => 1
)
[6] => Array
(
[id] => 7
[member_id] => 11
[total] => 3
[mainroomid] => 1
)
)
上面的数据是从MySQL数据库返回的,我的逻辑被困在这里,我想相应地循环数据并将数据重新排列到一个新数组中。是否意味着所有相同的会员id我需要将所有的总数相加并根据mainroomid分开。任何人都可以帮忙解决这个问题:(?下面是我需要显示的数据。
函数式编程