Reading and Writing CSV Files in PHP

PHP provides fgetcsv and fputcsv. But I was interested to use a PHP 5.3 library Easy CSV by Jonathan H. Wage, one of the core contributor of Doctrine Project , for the easiness to use . I just copied some of the examples from the library for you. You can always look over and use it :) . Reader : $reader = new \EasyCSV\Reader(‘read.csv’); while ($row = $reader->getRow()) { print_r($row); } Writer $writer = new \EasyCSV\Writer(‘write.csv’); $writer->writeFromArray(array( ‘value1, value2, value3’, array(‘value1’, ‘value2’, ‘value3’) ));

csv, php