What is the purpose of the file_put_contents() function in PHP?
- To write data to a file
- To read data from a file
- To delete a file
- To rename a file
The file_put_contents() function in PHP is used to write data to a file. It takes the file name and the data to be written as parameters and writes the data to the specified file. This function is a convenient way to write data to a file without explicitly opening and closing the file handles. Learn more: http://php.net/manual/en/function.file-put-contents.php
Loading...
Related Quiz
- Superglobals in PHP are accessed just like any other variable, but they are always available, no matter where you are in the script, even within ______.
- How are strings defined in PHP?
- How do you create an object in PHP?
- How can you handle file uploads in PHP? Discuss the steps involved and best practices to ensure security and validation.
- What is the data type in PHP that is used to store a sequence of characters?