I have an array for example
Array
(
[0] => Array
(
[id] => 6
[name] => ah
[order] => 4
)
[1] => Array
(
[id] => 5
[name] => hz
[order] =>
)
[2] => Array
(
[id] => 7
[name] => ch
[order] =>
)
[3] => Array
(
[id] => 5
[name] =>
[order] =>
)
[4] => Array
(
[id] => 4
[name] => zh
[order] => 1
)
)
It needs to be sorted first by "order", if order isn't available, it is sorted in alphabetical order with the "name" (but those arrays goes after all the arrays that have the sort order), and if no "order" and no "name", it goes at the end of the array.
So the above array would need to become:
Array
(
[0] => Array
(
[id] => 4
[name] => zh
[order] => 1
)
[1] => Array
(
[id] => 6
[name] => ah
[order] => 4
)
[2] => Array
(
[id] => 7
[name] => ch
[order] =>
)
[3] => Array
(
[id] => 5
[name] => hz
[order] =>
)
[4] => Array
(
[id] => 5
[name] =>
[order] =>
)
)
I've tried some for looping but nothing close to a solution.