Page 1 of 1

length argument in fgetcsv

Posted: Wed Jan 04, 2006 11:40 pm
by anjanesh
From PHP Manual fgetcsv(),
length (Optional)

Must be greater than the longest line (in characters) to be found in the CSV file (allowing for trailing line-end characters). It became optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP 5.0.4 and later) the maximum line length is not limited, which is slightly slower.
I ran the exact code which has the line while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
My CSV file has some lines greater than 1000 characters. It still read the fields.
What exactly is the length argument ?

Thanks

Posted: Thu Jan 05, 2006 7:30 am
by feyd
Are you running PHP 5 or greater?

Posted: Thu Jan 05, 2006 7:47 am
by anjanesh
Running PHP 5.0.3 but its mentioned - or setting it to 0 in PHP 5.0.4 and later