Skip to content

Commit

Permalink
Update CsvFileIterator.php
Browse files Browse the repository at this point in the history
  • Loading branch information
stopsopa committed Aug 10, 2017
1 parent 403f6d2 commit bd14a3f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Lib/CsvFileIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@
use Stopsopa\UtilsBundle\Lib\Standalone\UtilFilesystem;
use Iterator;

/**
$file = '2017-08-10-dump.txt';
$csv = new CsvFileIterator($file, array(
'delimiter' => "\t"
));
$row = 0;
$headers = array();
foreach ($csv as $item) {
if ($row === 0) {
$headers = $item;
}
else {
$item = array_combine($headers, $item);
print_r($item);
}
if ($row > 5) {
break;
}
$row += 1;
}
*/
class CsvFileIterator implements Iterator
{
protected $file;
Expand Down

0 comments on commit bd14a3f

Please sign in to comment.