I have looked at numerous threads relating to this and none of them have been of any help to me. I have an array which follows the basic structure of $array[location][store][person] = funds. What is the most efficient way of sorting the array so that the [person] key is in ASC order?
This is what it looks like now:
Array
(
[Florida] => Array
(
[AppleSauce] => Array
(
[Rabbit, Hunting] => 5
[Brown, Bubba] => 20
[Chicken, Cantina] => 10
[Gum, Bubble] => 10
[Pool, Swimming] => 4
[Bath, Taka] => 2
)
)
[Texas] => Array
(
[BeatleJuice] => Array
(
[Chicken, Cantina] => 10
[Pool, Swimming] => 4
[House, Road] => 5
)
[CaramelApple] => Array
(
[Chicken, Cantina] => 10
[Pool, Swimming] => 4
[House, Road] => 5
)
)
This is what I am looking for:
Array
(
[Florida] => Array
(
[AppleSauce] => Array
(
[Bath, Taka] => 2
[Brown, Bubba] => 20
[Chicken, Cantina] => 10
[Gum, Bubble] => 10
[Pool, Swimming] => 4
[Rabbit, Hunting] => 5
)
)
[Texas] => Array
(
[BeatleJuice] => Array
(
[Chicken, Cantina] => 10
[House, Road] => 5
[Pool, Swimming] => 4
)
[CaramelApple] => Array
(
[Chicken, Cantina] => 10
[House, Road] => 5
[Pool, Swimming] => 4
)
)
asort()should work. php.net/manual/en/function.asort.phpasort(),uksort(),ksort(), andarray_multisort(), and I can't get any of them to work. According to the manual they should work, but how do you apply it to a multidimensional array like the one I have?