Array
(
[Baritone Horn] => Array
(
[0] => Array
(
[Name] => Baritone Maintenance
[Order] => 12
[CategoryID] => 13849839018
)
[1] => Array
(
[Name] => Baritone Mouthpieces
[Order] => 13
[CategoryID] => 13850963018
)
[2] => Array
(
[Name] => Accessories
[Order] => 11
[CategoryID] => 13850964018
)
)
[Alpen Horn] => Array
(
[0] => Array
(
[Name] => Baritone Maintenance
[Order] => 12
[CategoryID] => 13849839018
)
[1] => Array
(
[Name] => Baritone Mouthpieces
[Order] => 13
[CategoryID] => 13850963018
)
[2] => Array
(
[Name] => Accessories
[Order] => 11
[CategoryID] => 13850964018
)
)
)
I want to:
Sort my array so that the array is ordered alphabetically like "Alpen Horn" then "Baritone Horn". This can be acheived using ksort but there may be a better way after considering my second point.
Sort each of the child arrays alphabetically so that each of the child arrays are sorted by [Name].
I know I need to use usort but my experiments so far have been uneventful.
Below is what I want to output:
Array
(
[Alpen Horn] => Array
(
[0] => Array
(
[Name] => Accessories
[Order] => 11
[CategoryID] => 13850964018
)
[1] => Array
(
[Name] => Baritone Maintenance
[Order] => 12
[CategoryID] => 13849839018
)
[2] => Array
(
[Name] => Baritone Mouthpieces
[Order] => 13
[CategoryID] => 13850963018
)
)
[Baritone Horn] => Array
(
[0] => Array
(
[Name] => Accessories
[Order] => 11
[CategoryID] => 13850964018
)
[1] => Array
(
[Name] => Baritone Maintenance
[Order] => 12
[CategoryID] => 13849839018
)
[2] => Array
(
[Name] => Baritone Mouthpieces
[Order] => 13
[CategoryID] => 13850963018
)
)
)