How do I sort the following array so that the houses are sorted Red, Green and Blue (George: Position 0, Steve: Position [1], and Fred: Position [2])?
Array
(
[catOne] => Array
(
[0] => Array
(
[Opponent] => Steve
[House_Colour] => Green
)
[1] => Array
(
[Opponent] => Fred
[House_Colour] => Blue
)
[2] => Array
(
[Opponent] => George
[House_Colour] => Red
)
)
[catTwo] => Array
(
[0] => Array
(
[Opponent] => Peter
[House Colour] => Green
)
)
)
I've tried using sort(), asort(), and usort() but nothing does what I need?
Edit: The sorting needs to be able to be changed easily. It can be in any order of House colour. The order used is just an example.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…