I looked around for a solution, both on Google and SO, but it’s pretty late, so apologies if I’m missing something really obvious.
In PHP, I have an array set up, $rooms, such that it looks like:
Array
(
[0] => Array
(
[title] => Bedroom
[area] => 16.00
[length] => 4.00
[width] => 4.00
[level] => U
)
[1] => Array
(
[title] => Kitchen
[area] => 18.00
[length] => 2.00
[width] => 9.00
[level] => 1
)
[2] => Array
(
[title] => Basement
[area] => 32.00
[length] => 8.00
[width] => 4.00
[level] => 2
)
[3] => Array
(
[title] => Bathroom
[area] => 9.00
[length] => 3.00
[width] => 3.00
[level] => L
)
[3] => Array
(
[title] => Deck
[area] => 9.00
[length] => 3.00
[width] => 3.00
[level] => n/a
)
)
I’m wanting to group the entries with the same level keys (I.e., “sort them so they’re together”). However, I also need the level groups to be in the following order: 1, n/a, 2, 3, 4, (and on), U, L, B
I figure I need to use uasort();, but I just can’t wrap my head around the examples.
Any help? Many thanks!
Try with: