Just discovered this and I am mighty impressed. It seems that in PHP 5.1 and higher there are the functions fgetcsv() and fputcsv(). They make it pretty simple to read and write a csv file.
Here is a simple example which reads a csv file, adds a couple of fields and writes it to a new file.
just what i was looking for, got a csv of 35,000 lines i need to add extra data to,
Thanks alot
Pete
Also if you dont mind taking a bit of a performance hit leave out the 1000 from the line:
while (($data = fgetcsv($inputfp, 1000, ",")) !== FALSE) {
if you have long fields this will shorten them, in PHP 5 you can omit that