mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
[PHP 8.1] Update fputcsv
and SplFileObject::fputcsv
description (#978)
This commit is contained in:
parent
422bb03223
commit
fcbbbd9fda
2 changed files with 40 additions and 8 deletions
|
@ -10,16 +10,17 @@
|
|||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>int</type><type>false</type></type><methodname>fputcsv</methodname>
|
||||
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>fields</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>'"'</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>escape_char</parameter><initializer>"\\"</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>eol</parameter><initializer>"\n"</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>fputcsv</function> formats a line (passed as a
|
||||
<parameter>fields</parameter> array) as CSV and writes it (terminated by a
|
||||
newline) to the specified file <parameter>handle</parameter>.
|
||||
newline) to the specified file <parameter>stream</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -28,7 +29,7 @@
|
|||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>handle</parameter></term>
|
||||
<term><parameter>stream</parameter></term>
|
||||
<listitem>
|
||||
&fs.validfp.all;
|
||||
</listitem>
|
||||
|
@ -60,22 +61,31 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>escape_char</parameter></term>
|
||||
<term><parameter>escape</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The optional <parameter>escape_char</parameter> parameter sets the
|
||||
The optional <parameter>escape</parameter> parameter sets the
|
||||
escape character (at most one single-byte character).
|
||||
An empty string (<literal>""</literal>) disables the proprietary escape mechanism.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>eol</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The optional <parameter>eol</parameter> parameter sets
|
||||
a custom End of Line sequence.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
If an <parameter>enclosure</parameter> character is contained in a field,
|
||||
it will be escaped by doubling it, unless it is immediately preceded by an
|
||||
<parameter>escape_char</parameter>.
|
||||
<parameter>escape</parameter>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
@ -99,10 +109,16 @@
|
|||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>8.1.0</entry>
|
||||
<entry>
|
||||
The optional <parameter>eol</parameter> parameter has been added.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>7.4.0</entry>
|
||||
<entry>
|
||||
The <parameter>escape_char</parameter> parameter now also accepts an empty
|
||||
The <parameter>escape</parameter> parameter now also accepts an empty
|
||||
string to disable the proprietary escape mechanism.
|
||||
</entry>
|
||||
</row>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>"\""</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>eol</parameter><initializer>"\n"</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Writes the <parameter>fields</parameter> array to the file as a CSV line.
|
||||
|
@ -59,6 +60,15 @@
|
|||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>eol</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The optional <parameter>eol</parameter> parameter sets
|
||||
a custom End of Line sequence.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -102,6 +112,12 @@
|
|||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>8.1.0</entry>
|
||||
<entry>
|
||||
The optional <parameter>eol</parameter> parameter has been added.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>7.4.0</entry>
|
||||
<entry>
|
||||
|
|
Loading…
Reference in a new issue