reference/spl/splfileobject/fputcsv.xml
d51166ca16fda8e766849505b84f9306ef443f71
...
...
@@ -1,6 +1,5 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
3
<refentry xml:id="splfileobject.fputcsv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>SplFileObject::fputcsv</refname>
...
...
@@ -9,12 +8,13 @@
9
8

10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
-
<methodsynopsis>
13
-
<modifier>public</modifier> <type>int</type><methodname>SplFileObject::fputcsv</methodname>
11
+
<methodsynopsis role="SplFileObject">
12
+
<modifier>public</modifier> <type class="union"><type>int</type><type>false</type></type><methodname>SplFileObject::fputcsv</methodname>
14
13
<methodparam><type>array</type><parameter>fields</parameter></methodparam>
15
-
<methodparam choice="opt"><type>string</type><parameter>delimiter</parameter><initializer>","</initializer></methodparam>
16
-
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>'"'</initializer></methodparam>
17
-
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\"</initializer></methodparam>
14
+
<methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
15
+
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>"\""</initializer></methodparam>
16
+
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
17
+
<methodparam choice="opt"><type>string</type><parameter>eol</parameter><initializer>"\n"</initializer></methodparam>
18
18
</methodsynopsis>
19
19
<para>
20
20
Writes the <parameter>fields</parameter> array to the file as a CSV line.
...
...
@@ -33,11 +33,11 @@
33
33
</listitem>
34
34
</varlistentry>
35
35
<varlistentry>
36
-
<term><parameter>delimiter</parameter></term>
36
+
<term><parameter>separator</parameter></term>
37
37
<listitem>
38
38
<para>
39
-
The optional <parameter>delimiter</parameter> parameter sets the field
40
-
delimiter (one character only).
39
+
The optional <parameter>separator</parameter> parameter sets the field
40
+
delimiter (one single-byte character only).
41
41
</para>
42
42
</listitem>
43
43
</varlistentry>
...
...
@@ -46,7 +46,7 @@
46
46
<listitem>
47
47
<para>
48
48
The optional <parameter>enclosure</parameter> parameter sets the field
49
-
enclosure (one character only).
49
+
enclosure (one single-byte character only).
50
50
</para>
51
51
</listitem>
52
52
</varlistentry>
...
...
@@ -55,11 +55,28 @@
55
55
<listitem>
56
56
<para>
57
57
The optional <parameter>escape</parameter> parameter sets the
58
-
escape character (one character only).
58
+
escape character (at most one single-byte character).
59
+
An empty string (<literal>""</literal>) disables the proprietary escape mechanism.
60
+
</para>
61
+
</listitem>
62
+
</varlistentry>
63
+
<varlistentry>
64
+
<term><parameter>eol</parameter></term>
65
+
<listitem>
66
+
<para>
67
+
The optional <parameter>eol</parameter> parameter sets
68
+
a custom End of Line sequence.
59
69
</para>
60
70
</listitem>
61
71
</varlistentry>
62
72
</variablelist>
73
+
<note>
74
+
<para>
75
+
If an <parameter>enclosure</parameter> character is contained in a field,
76
+
it will be escaped by doubling it, unless it is immediately preceded by an
77
+
<parameter>escape</parameter>.
78
+
</para>
79
+
</note>
63
80
</refsect1>
64
81

65
82
<refsect1 role="returnvalues">
...
...
@@ -69,7 +86,7 @@
69
86
</para>
70
87
<para>
71
88
Returns &false;, and does not write the CSV line to the file, if the
72
-
<parameter>delimiter</parameter> or <parameter>enclosure</parameter>
89
+
<parameter>separator</parameter> or <parameter>enclosure</parameter>
73
90
parameter is not a single character.
74
91
</para>
75
92
</refsect1>
...
...
@@ -78,7 +95,7 @@
78
95
&reftitle.errors;
79
96
<para>
80
97
An <constant>E_WARNING</constant> level error is issued if the
81
-
<parameter>delimiter</parameter> or <parameter>enclosure</parameter>
98
+
<parameter>separator</parameter> or <parameter>enclosure</parameter>
82
99
parameter is not a single character.
83
100
</para>
84
101
</refsect1>
...
...
@@ -96,9 +113,16 @@
96
113
</thead>
97
114
<tbody>
98
115
<row>
99
-
<entry>5.5.21, 5.6.5</entry>
116
+
<entry>8.1.0</entry>
117
+
<entry>
118
+
The optional <parameter>eol</parameter> parameter has been added.
119
+
</entry>
120
+
</row>
121
+
<row>
122
+
<entry>7.4.0</entry>
100
123
<entry>
101
-
Added the <parameter>escape</parameter> parameter.
124
+
The <parameter>escape</parameter> parameter now also accepts an empty
125
+
string to disable the proprietary escape mechanism.
102
126
</entry>
103
127
</row>
104
128
</tbody>
...
...
@@ -155,7 +179,6 @@ aaa,bbb,ccc,dddd
155
179
</refsect1>
156
180

157
181
</refentry>
158
-

159
182
<!-- Keep this comment at the end of the file
160
183
Local variables:
161
184
mode: sgml
162
185