note 104082 modified in splfileobject.fgetcsv by thiago
| From: | thiago@php.net | Date: | Mon, 23 May 2011 14:16:13 +0000 |
| Subject: | note 104082 modified in splfileobject.fgetcsv by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179970@lists.php.net to get a copy of this message | ||
after setting the delimiter '\t' fgetcsv() truncates the value when it is empty string
workaround:
<?php
$file = new SplFileObject($path);
$file->setFlags(SplFileObject::DROP_NEW_LINE);
while ($file->valid()) {
$line = $file->fgets();
$line = explode("\t", $line);
print_r($line);
}
?>
--was--
after setting the delimiter '\t' fgetcsv() truncates the value when it is empty string
workaround:
$file = new SplFileObject($path);
$file->setFlags(SplFileObject::DROP_NEW_LINE);
while ($file->valid()) {
$line = $file->fgets();
$line = explode("\t", $line);
print_r($line);
}
http://php.net/manual/en/splfileobject.fgetcsv.php