Re: File_CSV as standalone package?
| From: | Tomas V.V.Cox | Date: | Sat, 30 Aug 2003 09:38:31 +0000 |
| Subject: | Re: File_CSV as standalone package? | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20867@lists.php.net to get a copy of this message | ||
On Saturday, August 30, 2003 10:24, Alan Knowles wrote:
>>
>> I doubt it too, unless people start using it and notice bugs. :) I plan
>> to use it to parse an exchange rate feed from the Bank of Canada, so it
>> still has use at least until XML can be imported and exported from
>> everything instead. (Just an interesting tidbit: the UN is making a seb
>> services section of its site with SOAP.)
> have a look at www.php.net/fgetcsv - for the most part File_CSV is
> redundant (Except in exceptional cases where the file cannot be handled
> by the build in functions..
Well, I would say that for the most part File_CSV provides features
that can't be handled with fgetcsv(). Just for mentioning some:
- Automatic discovering of the CSV format (separator, number of
fields, if uses quotation). With fgetcsv() you need to *know* this
params and need to pass them to the function. Not in all cases you
know this information.
- Error detecting in CSV files. It's usual that some entries in CSV
file are broken (more or less fields than expected for example).
- It can handle multilined quoted fields. The support for that was
introduced in the recent PHP 4.3.0 (cool addition btw), while this
class has more than one year old.
- It can *write* csv files (with error checking) just passing an array
(the class will quote when needed).
- It uses fgetcsv() if don't find the need to use the built-in php
parser, being the speed of this class almost the same as using
fgetcsv().
- It support parsing csv comming from strings (I'm pending on applying
the patch sent for that).
Since many time I like to make it a separate package. But cause I'm
lazy I never find time for writing doc I haven't done it yet.
--
Tomas V.V.Cox mailto:cox@idecnet.com