PHP code example of alc / csv

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

    

alc / csv example snippets



use Alc\Csv\CsvReader;

$csv = new CsvReader(__DIR__.'/data.csv');

print_r($csv->readAll());



use Alc\Csv\CsvWriter;

$csv = new CsvWriter(__DIR__.'/output.csv');

$csv->write(array(
	'Nom' => 'CHEMEL',
	'Prenom' => 'Alexis',
));

$csv->close();