PHP code example of shuchkin / simplecsv

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

    

shuchkin / simplecsv example snippets


if ( $csv = Shuchkin\SimpleCSV::parse('book.csv') ) {
	print_r( $csv->rows() );
}

ini_set('error_reporting', E_ALL );
ini_set('display_errors', 1 );

$csv = Shuchkin\SimpleCSV::import('books.csv');
print_r( $csv->rows() );

$items = [
	['ISBN', 'title', 'author'],
	['618260307','The Hobbit','J. R. R. Tolkien']
];
$csv = Shuchkin\SimpleCSV::export( $items );
echo '<pre>' . $csv . '</pre>';
/*
ISBN,title,author
618260307,The Hobbit,J. R. R. Tolkien
*/