$result = array();
foreach($new_arr as $k => $array){
if(isset($result[$array['new_id']]['new_value'])){
$result[$array['new_id']]['new_value'] += $array['new_value'];
}else{
$result[$array['new_id']]['new_value'] = $array['new_value'];
}
}
我测试过,没问题,如果还有什么不对的随时留言。
没看太明白,以前我写过一个.
你觉得好的话,就拿去借鉴一下.
Dim b(0 To 6) As String
Dim a(0 To 6) As String
Dim z(0 To 6) As String
Dim c As String
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Command1.Caption = "停止"
Timer1.Enabled = True
Timer1.Interval = 10
Else
Command1.Caption = "开始"
Timer1.Enabled = False
Call aaa
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
For I = 0 To 6
Text1(I) = ""
Text1(I).Font = "宋体"
Text1(I).FontSize = 20
Text1(I).Alignment = 2
Next I
End Sub
Private Sub Timer1_Timer()
'生成7位随机不重复的数字
For j = 0 To 6
1
Randomize
c = Int(35 * Rnd 1)
Text1(j) = c
If j > 0 Then
For e = 0 To j - 1
If Text1(j) = Text1(e) Then
GoTo 1
End If
Next e
End If
Next j
End Sub
Public Sub aaa()
'按从小到大顺序排序
For Y = 0 To 6
For I = Y To 6
If Val(Text1(Y)) > Val(Text1(I)) Then
TEMP = Text1(Y)
Text1(Y) = Text1(I)
Text1(I) = TEMP
End If
Next I
Next Y
End Sub