note 70290 added to function.fgetcsv
| From: | aruggirello at osu1 dot php dot net | Date: | Tue, 10 Oct 2006 16:20:58 +0000 |
| Subject: | note 70290 added to function.fgetcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118351@lists.php.net to get a copy of this message | ||
Whenever you have to parse CSV data that isn't stored in a file, or should you need to encode
your data as CSV, you may use my set of functions, featuring:
- bi-directional conversion, meaning you may read as well as write CSV data, to or from your arrays.
- Support for customizable field separator, newline character (also auto-detects and converts
Win/Mac/*nix newlines).
- separators, newlines (auto-converted), properly handled within fields enclosed in quotation marks.
Last line may or may not be terminated by a newline.
- checks for possibly corrupt data (whenever last field in last row starts, but is not terminated,
with a quotation mark).
- Top speed guaranteed by use of strpos(), substr() etc.; room yet for some optimization (especially
with associative arrays).
- Clean (no data stored or retrieved from outside function scope, except for CSVstruct array).
Requires PHP 4.3 or newer.
Enjoy!
Andrea Ruggirello
souce available at:
http://web.tiscali.it/caelisoft/provacsv.txt
----
Server IP: 83.138.144.80
Probable Submitter: 84.222.191.216
----
Manual Page -- http://www.php.net/manual/en/function.fgetcsv.php
Edit -- https://master.php.net/note/edit/70290
Del: integrated -- https://master.php.net/note/delete/70290/integrated
Del: useless -- https://master.php.net/note/delete/70290/useless
Del: bad code -- https://master.php.net/note/delete/70290/bad+code
Del: spam -- https://master.php.net/note/delete/70290/spam
Del: non-english -- https://master.php.net/note/delete/70290/non-english
Del: in docs -- https://master.php.net/note/delete/70290/in+docs
Del: other reasons-- https://master.php.net/note/delete/70290
Reject -- https://master.php.net/note/reject/70290
Search -- https://master.php.net/manage/user-notes.php