Re: fgetcsv doesn't return an array?

From: Date: Thu, 15 Mar 2012 20:28:58 +0000
Subject: Re: fgetcsv doesn't return an array?
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-317050@lists.php.net to get a copy of this message
On 15 Mar 2012, at 20:26, Jay Blanchard wrote: > [snip] >> Please, don't do that. Use this instead: >> while (($csvCurrentLine = fgetcsv($csvFile, 4096, ',')) !== FALSE) { >> } >> [/snip] > > Not sure why, but ok. Thanks everyone! An empty line would lead to $csvCurrentLine == array() which as a boolean would be false but would not necessarily mean EOF. By using === to check the value the expression will only evaluate to false at EOF or an error. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/

« previous php.general (#317050) next »