note 74276 added to function.fgetcsv
| From: | pinkgothic at gmail dot com | Date: | Tue, 03 Apr 2007 13:47:15 +0000 |
| Subject: | note 74276 added to function.fgetcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125040@lists.php.net to get a copy of this message | ||
I find the documentation mildly misleading:
fgetcsv() does not - as this documentation seemingly claims in the descriptive line - get a line out
of the file (via the file pointer) and then parses this for CSV fields, but instead retrieves a CSV
row out of the file, which it then splits into an array.
The difference may seem trivial, but reading the description of this function I feared it might not
support linebreaks in individual CSV values. Testing, however, revealed that fgetcsv()
[fortunately!] works as one would expect from a CSV parser, and my fears were without cause.
In fact, fgetcsv() is remarkably hard to break. It's not confused by the value
""",""" for example (three quotation marks followed by a comma
followed by three quotation marks - which represents the value "quotation mark, comma,
quotation mark" in case it's not immediately obvious).
I hope this extra documentation is helpful for someone.
----
Server IP: 217.160.72.57
Probable Submitter: 84.46.119.45
----
Manual Page -- http://www.php.net/manual/en/function.fgetcsv.php
Edit -- https://master.php.net/note/edit/74276
Del: integrated -- https://master.php.net/note/delete/74276/integrated
Del: useless -- https://master.php.net/note/delete/74276/useless
Del: bad code -- https://master.php.net/note/delete/74276/bad+code
Del: spam -- https://master.php.net/note/delete/74276/spam
Del: non-english -- https://master.php.net/note/delete/74276/non-english
Del: in docs -- https://master.php.net/note/delete/74276/in+docs
Del: other reasons-- https://master.php.net/note/delete/74276
Reject -- https://master.php.net/note/reject/74276
Search -- https://master.php.net/manage/user-notes.php