Re: note 84622 rejected and deleted from function.fgetcsv by notes editor danbrown
| From: | Douglas Purdy | Date: | Tue, 22 Jul 2008 14:13:43 +0000 |
| Subject: | Re: note 84622 rejected and deleted from function.fgetcsv by notes editor danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142496@lists.php.net to get a copy of this message | ||
My post did not
> ask questions, report bugs or suggest new features;
it clarified the very sparse documentation for the fgetcsv function.
It should be re-posted.
--- On Tue, 7/22/08, php-notes@lists.php.net <php-notes@lists.php.net> wrote:
> From: php-notes@lists.php.net <php-notes@lists.php.net>
> Subject: note 84622 rejected and deleted from function.fgetcsv by notes editor danbrown
> To: gdpurdy@yahoo.com
> Date: Tuesday, July 22, 2008, 10:14 AM
> You are receiving this email because your note posted
> to the online PHP manual has been removed by one of the
> editors.
>
> Read the following paragraphs carefully, because they
> contain
> pointers to resources better suited for requesting support
> or
> reporting bugs, none of which are to be included in manual
> notes
> because there are mechanisms and groups in place to deal
> with
> those issues.
>
> The user contributed notes are not an appropriate place to
> ask questions, report bugs or suggest new features; please
> use the resources listed on <http://php.net/support>
> for those purposes. This was clearly stated in the page
> you used to submit your note, please carefully re-read
> those instructions before submitting future contributions.
>
> Bug submissions and feature requests should be entered at
> <http://bugs.php.net/>. For documentation errors use
> the
> bug system, and classify the bug as "Documentation
> problem".
> Support and ways to find answers to your questions can be
> found
> at <http://php.net/support>.
>
> Your note has been removed from the online manual.
>
> ----- Copy of your note below -----
>
> Like pinkgothic at gmail dot com, 03-Apr-2007, I also found
> the documentation mildly misleading and also lacking a basic
> description.
>
> "The length parameter ... became optional in PHP
> 5"
> It IS required with PHP 4:
> array fgetcsv ( resource $handle , int $length [, string
> $delimiter [, string $enclosure [, string $escape ]]] )
>
> fgetcsv is a specialized combination of fgets() and split()
> that reads a file and splits each record into an array based
> on $delimiter (default: comma) but ignoring any delimiters
> within $enclosure (default:double quotes)
>
> $fp1=fopen($inputfile,"r");
>
> while(!feof($fp1)){
> $record = fgetcsv($fp1,1000);
> // For example a csv record formatted as:
> // ,"Abels",,"Karen D.","123,
> Test blvd, Apt
>
> 7","Anytown","PA","19123-1234","610,644-1234",,,,,"""Harry""",
>
>
> // is stored as
> print_r($record); // (partially shown here)
> Array ( [0] => [1] => Abels [2] => [3] => Karen
> D. [4] => 123, Test blvd, Apt 7 ...
> [8] => 610,644-1234 ... [13] => "Harry" )
>
> Any commas within a field were ignored and quotes within a
> field were handled correctly.