Vraag : HOE TE OM MULT-SCHEMERIGE SERIE IN PHP TE SORTEREN

Ik heb een multidimensionele serie in PHP en zou een tariefgebied willen sorteren door structuur order.
The van de serie te stijgen ben hier in de Gehechtheid van de Code.  De hiërarchie van deze serie is als volgt:  Het PLATFORM kan vele FABRIKANT hebben die velen kan hebben MODEL.
I am het berekenen effiencyclassificatie voor elk PLATFORM, MFG, en MODELrij door het aantal incidenten/inventaristelling te nemen om breukverhouding af te leiden. de sub-serie van TARIEVEN
The beantwoordt aan rijen in de andere sub-series; d.w.z. voor PLATFORM, MODELLEERT MFG, en een efficiencytarief wordt berekend.  Zo, als ik het dalen van TARIEVEN sorteer, zou ik dat slechts binnen MFG/MODEL willen doen ik rijen uit output in bijlage van arraybut verliet genoeg verwijderde om structuur en inhoud te tonen. Om het even welke ideeën?
" codeBody "
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
Array
(
    [identiteitskaart] Serie =>
        (
            [0] => 0
            [1] => 1
            [2] => 2
            [3] => 3
            [4] => 3
            [5] => 3
            [6] => 2
            [7] => 3
            [8] => 3
            [9] => 3
            [39] => 2
            [40] => 3
            [41] => 2
            [42] => 3
            [43] => 3
         )

    [platform] Serie =>
        (
            [0] => OP BEDRIJFSNIVEAU
            [SERVER 1] =>
            [2] SERVER =>
            [3] SERVER =>
            [4] SERVER =>
            [5] SERVER =>
            [6] SERVER =>
            [7] SERVER =>
            [8] SERVER =>
            [9] SERVER =>
            [39] SERVER =>
            [40] SERVER =>
            [41] SERVER =>
            [42] SERVER =>
            [43] SERVER =>
            [44] SERVER =>
            
        )

    [mfg] Serie =>
        (
            [0] => 
            [1] => 
            [2] => FUJITSU
            [3] => FUJITSU
            [4] => FUJITSU
            [5] => FUJITSU
            [6] => IBM
            [7] => IBM
            [8] => IBM
            [9] => IBM
            [39] => ANDERE
            [40] => ANDERE
            [41] ZON =>
            [42] ZON =>
            [43] ZON =>
            
        )

    [model] Serie =>
        (
            [0] => 
            [1] => 
            [2] => 
            [3] => 250
            [4] => 650
            [5] => 850
            [6] => 
            [7] => 7017-S80
            [8] => 7026-6H1
            [9] => 7026-6M1
            [39] => 
            [40] => K460
            [41] => 
            [42] => 1000E
            [43] => 12K
            
        )

    [telling] Serie =>
        (
            [0] => 503
            [1] => 503
            [2] => 1
            [3] => 1
            [4] => 1
            [5] => 1
            [6] => 50
            [7] => 1
            [8] => 1
            [9] => 2
            [39] => 1
            [40] => 1
            [41] => 451
            [42] => 1
            [43] => 2
         )    

    [invcount] Serie =>
        (
            [0] => 21556
            [1] => 21556
            [2] => 57
            [3] => 13
            [4] => 10
            [5] => 26
            [6] => 1653
            [7] => 36
            [8] => 11
            [9] => 37
            [39] => 0
            [40] => 0
            [41] => 19836
            [42] => 0
            [43] => 18
            
        )

    [tarief] Serie =>
        (
            [0] => 2.33
            [1] => 2.33
            [2] => 1.75
            [3] => 7.69
            [4] => 10.00
            [5] => 3.85
            [6] => 3.02
            [7] => 2.78
            [8] => 9.09
            [9] => 5.41
            [39] => 0
            [40] => 0
            [41] => 2.27
            [42] => 0
            [43] => 11.11
            
        )

    [deleteflag] Serie =>
        (
            [0] => 0
            [1] => 0
            [2] => 0
            [3] => 0
            [4] => 0
            [5] => 0
            [6] => 0
            [7] => 1
            [8] => 0
            [9] => 0
            [39] => 0
            [40] => 0
            [41] => 0
            [42] => 1
            [43] => 0
            
        )

    [l2rate] Serie =>
        (
            [0] => 0
            [1] => 0
            [2] => 1.75
            [3] => 1.75
            [4] => 1.75
            [5] => 1.75
            [6] => 3.02
            [7] => 3.02
            [8] => 3.02
            [9] => 3.02
            [39] => 0
            [40] => 0
            [41] => 2.27
            [42] => 2.27
            [43] => 2.27
            
        )

)

Antwoord : HOE TE OM MULT-SCHEMERIGE SERIE IN PHP TE SORTEREN

Ik zou van uw tariefserie knallen u het zo alleen gebruikend asort sorteert (die indexen handhaaft).

zo…
$rate_array = serie [tarief];
asort ($rate_array)

nu hebt u een serie van alle tarieven en indexen in de juiste orde. Nu, zou ik breken apart alle series dan herbouw één grote met één of ander codesoort gelijkaardig

foreach ($rate_array als $key=>$value) {
    $id_value = $id_array [$key];
    array_push ($new_id_array);
    etc….
}
Andere oplossingen  
 
programming4us programming4us