Okay, a before;
Array (
'home' => array('order' => 1),
'about' => array(),
'folio' => array('order' => 2),
'folio/web' => array('order' => 2),
'folio/print' => array('order' => 1)
'contact' => array('order' => 2)
)
And a desired after;
Array (
'home' => array('order' => 1),
'contact' => array('order' => 2),
'folio' => array('order' => 2),
'folio/print' => array('order' => 1),
'folio/web' => array('order' => 2),
'about' => array()
)
I know, horrific (don’t ask!)
See how the slash in the key indicates children, and how the order is nested accordingly? And items without orders are simply shifted to the bottom.
But also how multiple ‘same level’ items with the same order are merely sorted by key?
Damn, almost worth to get a bubblesort algorithm and skip all sorting functions altogether.
However: if you do one loop:
… I see no reason that it couldn’t be implemented with uasort(), albeit dirty work…