I am trying to get all stores on a Magento shop. By all stores, I mean all stores from all websites. I wrote this code and it works, but I'm a little concerned about the complexity of the nested foreach loop. Please take a look at it and advise me if you think I can do something different.
public function getAllStoresCustom(){
    $all_stores = array();
        foreach (Mage::app()->getWebsites() as $website) {
            foreach ($website->getGroups() as $group) {
                $all_stores [] = $group->getStores();      
            }
        }
    return $all_stores;
}
I've only found these functions in Magento, so I think I had to use those and this seemed the only combination that worked.
Thanks a lot
 
     
     
    