If filename does not exist, the file is created.
Otherwise, the existing file is overwritten, unless the
FILE_APPEND flags is set.
Path to the file where to write the data.
The data to write. Can be either a string, an array or a stream resource (explained above).
If data is a stream resource, the remaining buffer of that stream will be copied to the specified file. This is similar with using stream_copy_to_stream().
You can also specify the data parameter as a single
dimension array. This is equivalent to
file_put_contents($filename, implode('', $array)).
The value of flags can be any combination of
the following flags (with some restrictions), joined with the binary OR
||Search for filename in the include directory. See include_path for more information.|
||If file filename already exists, append the data to the file instead of overwriting it.|
||Acquire an exclusive lock on the file while proceeding to the writing.|
data is written in text mode. If unicode
semantics are enabled, the default encoding is UTF-8.
You can specify a different encoding by creating a custom context
or by using the stream_default_encoding() to
change the default. This flag cannot be used with
data will be written in binary mode. This
is the default setting and cannot be used with
A valid context resource created with stream_context_create().
The function returns the amount of bytes that were written to the file, or
FALSE on failure.
|5.0.0||Added context support|
Added support for |
Added support for the |
This function is binary-safe.