Exemple #1
0
 public function setRecipients($a)
 {
     $parser = new CSVParser($a);
     $this->recipients = $parser->parse();
 }
<?php

require_once 'classes/CSVParser.php';
$csv = new CSVParser('cliente.csv', ';');
$csv->parse();
while ($row = $csv->fetch()) {
    print $row['Cliente'] . ' - ';
    print $row['Cidade'] . "<br>\n";
}
Exemple #3
0
/**
 * Parse CSV files into a two dimensional array.
 * (Convenience function for CSVParser::parse().)
 *
 * @param Iterator $lineIterator
 *   An Iterator object that yields line strings, e.g. CSVFileLineIterator.
 * @return
 *   Two dimensional array that contains the data in the CSV file.
 */
function csv_parse(Iterator $lineIterator, $delimiter = ',', $skipFirstLine = FALSE)
{
    $parser = new CSVParser();
    $parser->setDelimiter($delimiter);
    $parser->setSkipFirstLine($skipFirstLine);
    return $parser->parse($lineIterator);
}