PHP Function Fputs
The php function fputs is an inbuilt function that is used to write string or set of characters to the file during the process of file handling. This function is similar to the puts() function that is used for writing message to the console or window terminal, but differs in that it does not append a newline as done by the puts() function.
The fputs() function is included in the standard library header stdio.h in the C programming language. The function identifies an address for a file descriptor, which is an area of memory associated with an output or input stream. The fputs() function writes an array of characters to the file stream specified by the file pointer argument, and optionally stops after a specified number of bytes have been written, or at the end of the string, whichever comes first.
To use the fputs() function, open a file using fopen() in a mode that supports writing (such as 'w'). Pass the file pointer and the string you want to write to the fputs() function.
The fputs() function returns the number of bytes written to the file on success, and FALSE on failure. The function can be called with any combination of arguments, but the file pointer and string must be valid. The length of the string cannot exceed the maximum amount of data that the open file can hold. This is because the 0 byte is not considered part of the data, and binary data must be terminated with a non-0 byte.