reference/filesystem/functions/file-put-contents.xml
ea62fb83196997032641b50fe44420305466195e
...
...
@@ -4,17 +4,17 @@
4
4
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.file-put-contents">
5
5
<refnamediv>
6
6
<refname>file_put_contents</refname>
7
-
<refpurpose>Write a string to a file</refpurpose>
7
+
<refpurpose>Write data to a file</refpurpose>
8
8
</refnamediv>
9
9

10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<methodsynopsis>
13
-
<type>int</type><methodname>file_put_contents</methodname>
13
+
<type class="union"><type>int</type><type>false</type></type><methodname>file_put_contents</methodname>
14
14
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
15
15
<methodparam><type>mixed</type><parameter>data</parameter></methodparam>
16
16
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
17
-
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
17
+
<methodparam choice="opt"><type class="union"><type>resource</type><type>null</type></type><parameter>context</parameter><initializer>&null;</initializer></methodparam>
18
18
</methodsynopsis>
19
19
<para>
20
20
This function is identical to calling <function>fopen</function>,
...
...
@@ -103,7 +103,10 @@
103
103
</entry>
104
104
<entry>
105
105
Acquire an exclusive lock on the file while proceeding to the
106
-
writing.
106
+
writing. In other words, a <function>flock</function> call happens
107
+
between the <function>fopen</function> call and the
108
+
<function>fwrite</function> call. This is not identical to an
109
+
<function>fopen</function> call with mode "x".
107
110
</entry>
108
111
</row>
109
112
</tbody>
...
...
@@ -172,31 +175,6 @@ file_put_contents($file, $person, FILE_APPEND | LOCK_EX);
172
175
</para>
173
176
</refsect1>
174
177
175
-
<refsect1 role="changelog">
176
-
&reftitle.changelog;
177
-
<para>
178
-
<informaltable>
179
-
<tgroup cols="2">
180
-
<thead>
181
-
<row>
182
-
<entry>&Version;</entry>
183
-
<entry>&Description;</entry>
184
-
</row>
185
-
</thead>
186
-
<tbody>
187
-
<row>
188
-
<entry>5.1.0</entry>
189
-
<entry>
190
-
Added support for <constant>LOCK_EX</constant> and the ability to pass
191
-
a stream resource to the <parameter>data</parameter> parameter
192
-
</entry>
193
-
</row>
194
-
</tbody>
195
-
</tgroup>
196
-
</informaltable>
197
-
</para>
198
-
</refsect1>
199
-
200
178
<refsect1 role="notes">
201
179
&reftitle.notes;
202
180
&note.bin-safe;
203
181