I have a php function which builds an array with category data like so:
$categories = array();
foreach($catIds as $catId) {
$category = Mage::getModel('catalog/category')->load($catId);
$categories[$category->getName()] = array(
'url' => $category->getUrl(),
'img' => $category->getImageUrl(),
'thumb' => Mage::getBaseUrl('media').'catalog' . DS . 'category' . DS.$category->getThumbnail(),
'position' => $category->getPosition()
);
}
I am wanting to sort the $categories array by the 'position' value. I have tried a few variations of ksort and array_multisort but haven't been able to find a solution.