In this article, we are going to discuss how to write into a text file using the PHP built-in fwrite() function.
The fwrite() function is used to write into the given file. It stops at the end of the file or when it reaches the specified length passed as a parameter, whichever comes first.
- file_name: The name of the input file
- string: The content to be written.
Return Value: It returns the number of bytes written on success, or false on failure.
Example 1 :