I'm having trouble sorting an array according to another array. I've tried usort, uksort and uasort but I'm getting nowhere. Other questions on stackoverflow are not directly applicable here, as my array structure is different. I want to sort this multidimensional array:
$main = Array (
[Technology] => Array ()
[World] => Array ()
[Europe] => Array ()
)
By using this index-array:
$index = Array (
[0] => Europe
[1] => Technology
[2] => World
)
Basically, in this example I would want Europe to come first in the $main array, Technology second and World third, as this is their positioning in the $index array. How do I do that? (Please disregard little syntax errors in the arrays above)
ksort
? – bsdnoobz May 22 '12 at 12:50