Re: fgetcsv doesn't return an array?
| From: | Matijn Woudt | Date: | Thu, 15 Mar 2012 17:23:58 +0000 |
| Subject: | Re: fgetcsv doesn't return an array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317028@lists.php.net to get a copy of this message | ||
On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard
<jay.blanchard@sigmaphinothing.org> wrote:
> I thought that fgetcsv returned an array. I can work with it like an array
> but I get the following warning when using it
>
> |Warning: implode(): Invalid arguments passed on line 155
>
> 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ',');
> 155 $currentLine = implode(",", $csvCurrentLine);
> |
>
> Everything that I have read online indicates that it is because
> $csvCurrentLine is not declared as an array. Adding a line to the code
>
> 153 |$csvCurrentLine = array();
>
> Does not get rid of the warning. The warning isn't interfering with the
> script working, but it us annoying. Does anyone know the solution?
>
> Thanks!
>
> Jay
> |
Are you using this in a loop or something? fgetcsv returns FALSE on
errors, including End Of File.
- Matijn