/**
 * An extended PHP str_getcsv function wrapper 
 * @param String line
 * @param String delimiter
 * @param Boolean removeBOM (optional)
 * @return Array
 */
function parceCSVLine($line, $delimiter, $removeBOM = false)
{
    $line = cutBOM($line);
    return str_getcsv($line, $delimiter);
}
Example #2
0
 /**
  * Get no more then N not empty lines from a file
  * @param Mixed fileHandle CSV file hanle
  * @param Number
  * @return Array
  */
 protected function getNLinesFromFile($fileHandle, $N)
 {
     $lines = array();
     while (count($lines) < $N) {
         $line = getLineFromFile($fileHandle, 1000000);
         if ($line === FALSE) {
             break;
         }
         $line = cutBOM($line);
         if (strlen(trim($line))) {
             $lines[] = $line;
         }
     }
     return $lines;
 }