我有一个数组:
array(5) {
[A] => array(2) {
[price] => string(3) "800"
[score] => string(1) "8"
}
[B] => array(2) {
[price] => string(3) "800"
[score] => string(2) "10"
}
[C] => array(2) {
[price] => string(3) "800"
[score] => string(2) "15"
}
[D] => array(2) {
[price] => string(4) "1800"
[score] => string(1) "4"
}
[E] => array(2) {
[price] => string(4) "2800"
[score] => string(1) "5"
}
}
我已根据价格(ASC订单)成功排序:this
问题是如果价格相同,我还需要根据分数应用二级排序(最高分应该是第一个)。
所需的数组应该是:
array(
5) {
[C] => array(2) {
[price] => string(3) "800"
[score] => string(2) "15"
}
[B] => array(2) {
[price] => string(3) "800"
[score] => string(2) "10"
}
[A] => array(2) {
[price] => string(3) "800"
[score] => string(1) "8"
}
[D] => array(2) {
[price] => string(4) "1800"
[score] => string(1) "4"
}
[E] => array(2) {
[price] => string(4) "2800"
[score] => string(1) "5"
}
}
无法思考我必须走哪条路。有人可以帮忙吗。