note 58733 added to function.fgetcsv
| From: | junk at vhd dot com dot au | Date: | Mon, 14 Nov 2005 12:46:01 +0000 |
| Subject: | note 58733 added to function.fgetcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98543@lists.php.net to get a copy of this message | ||
Based on my observations a few comments below I have written a class that incorporates all these
features. Here is the class description:
----------
This class will parse a csv file in either standard or MS Excel format.
Two methods are provided to either process a line at a time or return the whole csv file as an
array.
It can deal with:
- Line breaks within quoted fields
- Character seperator (usually a comma or semicolon) in quoted fields
- Can leave or remove leading and trailing spaces or tabs
- Can leave or skip empty rows.
- Windows and Unix line breaks dealt with automatically. (Care must be taken with Macintosh format.)
Also, the escape character is automatically removed.
-----------
So basically it should "just work". If it doesn't please send me an email ;-)
You can download it from: http://www.phpclasses.org/browse/package/2672.html
An example on how to use the class and a test.csv file are also provided.
----
Manual Page -- http://www.php.net/manual/en/function.fgetcsv.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58733
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58733&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58733&report=yes
Search -- http://master.php.net/manage/user-notes.php