I have an Array:
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"
}
}
I have successfully sorted based on the price (ASC Order) by following: this
Problem is i need to apply second level sorting too based on the score if price is same (Highest score should come first).
The required array needed should be like:
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"
}
}
Not able to think which way i have to go. Can someone please help here.