PHP code example of whiteplus / csv

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

    

whiteplus / csv example snippets


$csvFile = new Whiteplus\Csv\CsvFile(__DIR__ . '/_data/test-input.csv');
foreach($csvFile as $row) {
	var_dump($row);
}

$csvFile = new Keboola\Csv\CsvFile(__DIR__ . '/_data/test-output.csv');
$rows = array(
	array(
		'col1', 'col2',
	),
	array(
		'line without enclosure', 'second column',
	),
);

foreach ($rows as $row) {
	$csvFile->writeRow($row);
}
bash