PHP code example of ogrrd / csv-iterator

1. Go to this page and download the library: Download ogrrd/csv-iterator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ogrrd / csv-iterator example snippets


use ogrrd\CsvIterator\CsvIterator;

$pathToFile = '/path/to/file.csv';
$delimiter = ','; // optional
$rows = new CsvIterator($pathToFile, $delimiter);
$rows->useFirstRowAsHeader();
foreach ($rows as $row) {
    // print_r($row);
}