1. Go to this page and download the library: Download gugglegum/csv-rw 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/ */
gugglegum / csv-rw example snippets
use \gugglegum\CsvRw\CsvReader;
use \gugglegum\CsvRw\CsvFormat;
$csv = new CsvReader(new CsvFormat([
'delimiter' => ',',
'enclosure' => '"',
'escape' => '\\',
]));
$csv->open('input.csv', CsvReader::WITH_HEADERS);
foreach ($csv as $row) {
var_dump($row);
}
$csv->close();