1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

Another fgetscv proprietary description. (#5101)

Co-authored-by: André L F S Bacci <ae@php.net>
This commit is contained in:
alfsb
2026-01-14 18:30:54 -03:00
committed by GitHub
parent 132d2a8d63
commit 3a89b55d11

View File

@@ -57,13 +57,17 @@
</para>
<warning>
<simpara>
Inside an <parameter>enclosure</parameter>, the <parameter>enclosure</parameter> character can always be <parameter>escaped</parameter> by doubling it,
resulting in a single <parameter>enclosure</parameter> character in the parsed result.
The <parameter>escaped</parameter> character works differently:
If it is followed by an <parameter>enclosure</parameter> character then that <parameter>enclosure</parameter> character will not be treated as one,
however the <parameter>escaped</parameter> character itself remains. So for the default parameters, <literal>""</literal>
inside an <parameter>enclosure</parameter> will be parsed into <literal>",</literal> while <literal>\"</literal> inside an
<parameter>enclosure</parameter> will be parsed into <literal>\"</literal>.
In the input stream, the <parameter>enclosure</parameter> character
can always be escaped by doubling it inside a quoted string,
resulting in a single <parameter>enclosure</parameter> character
in the parsed result.
The <parameter>escape</parameter> character works differently:
If a sequence of <parameter>escape</parameter> and
<parameter>enclosure</parameter> characters appear in the stream,
both characters will be present in the parsed value.
So for the default parameters, <literal>""</literal>
in quoted strings will be parsed as <literal>"</literal>, while
<literal>\"</literal> parsed as <literal>\"</literal>.
</simpara>
</warning>
<warning>
@@ -90,7 +94,7 @@
<note>
<para>
A blank line in a CSV file will be returned as an array
comprising a single &null; field unless using <constant>SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE</constant>,
comprising a single &null; field unless using <constant>SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE</constant>,
in which case empty lines are skipped.
</para>
</note>