reference/strings/functions/str-getcsv.xml
272838c8815f95572a60d30e39dfb1feba3e497c
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.str-getcsv">
3
+
<refentry xml:id="function.str-getcsv" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>str_getcsv</refname>
6
6
<refpurpose>
...
...
@@ -12,9 +12,9 @@
12
12
&reftitle.description;
13
13
<methodsynopsis>
14
14
<type>array</type><methodname>str_getcsv</methodname>
15
-
<methodparam><type>string</type><parameter>input</parameter></methodparam>
16
-
<methodparam choice="opt"><type>string</type><parameter>delimiter</parameter><initializer>","</initializer></methodparam>
17
-
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>'"'</initializer></methodparam>
15
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
16
+
<methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
17
+
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>"\""</initializer></methodparam>
18
18
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
19
19
</methodsynopsis>
20
20
<para>
...
...
@@ -35,7 +35,7 @@
35
35
<para>
36
36
<variablelist>
37
37
<varlistentry>
38
-
<term><parameter>input</parameter></term>
38
+
<term><parameter>string</parameter></term>
39
39
<listitem>
40
40
<para>
41
41
The string to parse.
...
...
@@ -43,10 +43,10 @@
43
43
</listitem>
44
44
</varlistentry>
45
45
<varlistentry>
46
-
<term><parameter>delimiter</parameter></term>
46
+
<term><parameter>separator</parameter></term>
47
47
<listitem>
48
48
<para>
49
-
Set the field delimiter (one character only).
49
+
Set the field delimiter (one single-byte character only).
50
50
</para>
51
51
</listitem>
52
52
</varlistentry>
...
...
@@ -54,7 +54,7 @@
54
54
<term><parameter>enclosure</parameter></term>
55
55
<listitem>
56
56
<para>
57
-
Set the field enclosure character (one character only).
57
+
Set the field enclosure character (one single-byte character only).
58
58
</para>
59
59
</listitem>
60
60
</varlistentry>
...
...
@@ -62,7 +62,7 @@
62
62
<term><parameter>escape</parameter></term>
63
63
<listitem>
64
64
<para>
65
-
Set the escape character (at most one character). Defaults as a backslash
65
+
Set the escape character (at most one single-byte character). Defaults as a backslash
66
66
(<literal>\</literal>)
67
67
An empty string (<literal>""</literal>) disables the proprietary escape mechanism.
68
68
</para>
...
...
@@ -117,6 +117,74 @@
117
117
</para>
118
118
</refsect1>
119
119

120
+
<refsect1 role="examples">
121
+
&reftitle.examples;
122
+
<para>
123
+
<example>
124
+
<title><function>str_getcsv</function> example</title>
125
+
<programlisting role="php">
126
+
<![CDATA[
127
+
<?php
128
+

129
+
$string = 'PHP,Java,Python,Kotlin,Swift';
130
+
$data = str_getcsv($string);
131
+

132
+
var_dump($data);
133
+
?>
134
+
]]>
135
+
</programlisting>
136
+
&example.outputs;
137
+
<screen>
138
+
<![CDATA[
139
+
array(5) {
140
+
[0]=>
141
+
string(3) "PHP"
142
+
[1]=>
143
+
string(4) "Java"
144
+
[2]=>
145
+
string(6) "Python"
146
+
[3]=>
147
+
string(6) "Kotlin"
148
+
[4]=>
149
+
string(5) "Swift"
150
+
}
151
+
]]>
152
+
</screen>
153
+
</example>
154
+
</para>
155
+
<para>
156
+
<example>
157
+
<title><function>str_getcsv</function> example with an empty string</title>
158
+
<caution>
159
+
<simpara>
160
+
On an empty string this function returns the value <code>[null]</code>
161
+
instead of an empty array.
162
+
</simpara>
163
+
</caution>
164
+
<programlisting role="php">
165
+
<![CDATA[
166
+
<?php
167
+

168
+
$string = '';
169
+
$data = str_getcsv($string);
170
+

171
+
var_dump($data);
172
+
?>
173
+
]]>
174
+
</programlisting>
175
+
&example.outputs;
176
+
<screen>
177
+
<![CDATA[
178
+
array(1) {
179
+
[0]=>
180
+
NULL
181
+
}
182
+
]]>
183
+
</screen>
184
+
</example>
185
+
</para>
186
+
</refsect1>
187
+

120
188
<refsect1 role="seealso">
121
189
&reftitle.seealso;
122
190
<para>
...
...
@@ -126,7 +194,6 @@
126
194
</para>
127
195
</refsect1>
128
196
</refentry>
129
-

130
197
<!-- Keep this comment at the end of the file
131
198
Local variables:
132
199
mode: sgml
133
200