note 74276 rejected from function.fgetcsv by danbrown

From: Date: Sun, 17 May 2009 18:11:11 +0000
Subject: note 74276 rejected from function.fgetcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155076@lists.php.net to get a copy of this message
Note Submitter: pinkgothic at gmail dot com ---- 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.

« previous php.notes (#155076) next »