What PHP function can be used to write to a file?
- readfile()
- file_get_contents()
- fwrite()
- fopen()
The fwrite() function in PHP is used to write to a file. It takes the file handle obtained from fopen() as the first argument and the content to write as the second argument. It returns the number of bytes written or false on failure.
Loading...
Related Quiz
- You need to define a constant in your PHP script that can be accessed anywhere in the script, regardless of scope. How would you do this?
- A common use case for the $GLOBALS superglobal in PHP is to access global variables from within a function, which would otherwise be out of the function's ______.
- You are writing a PHP script that needs to store multiple items in a single variable. What data type would you use and why?
- What is the data type in PHP that is used to store a sequence of characters?
- PHP requires a web server to run PHP scripts.