How collection is loaded in magento
devm.com.np

<?php
class Varien_Data_Collection implements IteratorAggregateCountable
{
    
/**
     * Implementation of IteratorAggregate::getIterator()
     */
    
public function getIterator()
    {
        
$this->load();
        return new 
ArrayIterator($this->_items);
    }

    
/**
     * Retireve count of collection loaded items
     *
     * @return int
     */
    
public function count()
    {
        
$this->load();
        return 
count($this->_items);
    } 
}

$products Mage::getModel('catalog/product')->getCollection();


//it creates ArrayIterator instance
foreach($products as $product)
{

}

?>