netjunky

Untitled

Sep 23rd, 2010
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. // Reading CSV file, line with small checks
  2.     public function getRecords() {
  3.         $result = array();
  4.        
  5.         if(($handle = fopen($this->filePath.$this->fileName, 'r')) !== FALSE) {
  6.        
  7.             while(!feof($handle)) {
  8.                 if(($output = fgetcsv($handle, null, $this->delim, $this->quoteType)) === FALSE) {
  9.                     continue;
  10.                 }
  11.                 if(!isset($output[1]) && '' === trim($output[0])) {
  12.                     continue;
  13.                 }
  14.                 if(empty($output)) {
  15.                     continue;
  16.                 }
  17.                 $result[] = $output;
  18.             }
  19.         }
  20.         fclose($handle);
  21.    
  22.         return $result;
  23.     }
Add Comment
Please, Sign In to add comment