View Single Post
Old 05-10-2009, 01:45 AM   #2 (permalink)
Enfernikus
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

It is a personal preference of mine, but I prefer to avoid switch statements when possible so I thought perhaps you would share this same bias and maybe prefer this way.

PHP Code:
public function fetch($fetch_type 'array')
{
    
$types = array(
                    
'array' => MYSQL_NUM,
                    
'assoc' => MYSQL_ASSOC,
                    
'both'    => MYSQL_BOTH
                  
);
     if( 
array_key_exists($fetch_type$types) )
     {
         return 
mysql_fetch_array($this->results$types[$fetch_type]);
     }

Enfernikus is offline  
Reply With Quote