Skip to content

Commit 3a89b55

Browse files
alfsbAndré L F S Bacci
andauthored
Another fgetscv proprietary description. (#5101)
Co-authored-by: André L F S Bacci <[email protected]>
1 parent 132d2a8 commit 3a89b55

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

reference/spl/splfileobject/fgetcsv.xml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,17 @@
5757
</para>
5858
<warning>
5959
<simpara>
60-
Inside an <parameter>enclosure</parameter>, the <parameter>enclosure</parameter> character can always be <parameter>escaped</parameter> by doubling it,
61-
resulting in a single <parameter>enclosure</parameter> character in the parsed result.
62-
The <parameter>escaped</parameter> character works differently:
63-
If it is followed by an <parameter>enclosure</parameter> character then that <parameter>enclosure</parameter> character will not be treated as one,
64-
however the <parameter>escaped</parameter> character itself remains. So for the default parameters, <literal>""</literal>
65-
inside an <parameter>enclosure</parameter> will be parsed into <literal>",</literal> while <literal>\"</literal> inside an
66-
<parameter>enclosure</parameter> will be parsed into <literal>\"</literal>.
60+
In the input stream, the <parameter>enclosure</parameter> character
61+
can always be escaped by doubling it inside a quoted string,
62+
resulting in a single <parameter>enclosure</parameter> character
63+
in the parsed result.
64+
The <parameter>escape</parameter> character works differently:
65+
If a sequence of <parameter>escape</parameter> and
66+
<parameter>enclosure</parameter> characters appear in the stream,
67+
both characters will be present in the parsed value.
68+
So for the default parameters, <literal>""</literal>
69+
in quoted strings will be parsed as <literal>"</literal>, while
70+
<literal>\"</literal> parsed as <literal>\"</literal>.
6771
</simpara>
6872
</warning>
6973
<warning>
@@ -90,7 +94,7 @@
9094
<note>
9195
<para>
9296
A blank line in a CSV file will be returned as an array
93-
comprising a single &null; field unless using <constant>SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE</constant>,
97+
comprising a single &null; field unless using <constant>SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE</constant>,
9498
in which case empty lines are skipped.
9599
</para>
96100
</note>

0 commit comments

Comments
 (0)