The given PHP example returns the all categories in magento. Code Example:
<?php function getCategories() { $categories = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToSelect('*') ->addIsActiveFilter(); $all = array(); foreach ($categories as $c) { $all[$c->getId()] = $c->getName(); } return $all; } ?>