I have an interesting challenge. I have an array that looks like this:
array(
[1] = array(
'fruit' => 'Banana'
),
[2] = array(
'fruit' => 'Apple'
),
[3] = array(
'fruit' => 'Grapes'
)
)
I need to sort the array according to fruit, presuming the fruit have this priority:
#1: Apple
#2: Banana
#3: Grapes
Ultimately the output should be:
array(
[2] = array(
'fruit' => 'Apple'
),
[1] = array(
'fruit' => 'Banana'
),
[3] = array(
'fruit' => 'Grapes'
)
)
Would this be done by some sort of usort() trickery?