PHP code example of yogarine / csv-utils

1. Go to this page and download the library: Download yogarine/csv-utils 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/ */

    

yogarine / csv-utils example snippets


$csvFile = new CsvFile('foo.csv');

foreach ($csvFile as $row) {
	$id          = $row['id'];
	$name        = $row['name'];
	$description = $row['description'];
}

$csvFile = new CsvFile('foo.csv', CsvFile::HEADER_ROW_NONE);

foreach ($csvFile as $row) {
	list($id, $name, $description) = $row;
}

$csvFile = new CsvFile('foo.csv', 0, '|');