Easy Tutorial
❮ Func Libxml Use Internal Errors Func String Strlen ❯

PHP fwrite() Function



Definition and Usage

The fwrite() function writes content to an open file.

The function stops running when it reaches the specified length or the end of the file (EOF), whichever comes first.

If the function executes successfully, it returns the number of bytes written. If it fails, it returns FALSE.

Syntax

Parameter Description
file Required. Specifies the open file to write to.
string Required. Specifies the string to write to the open file.
length Optional. Specifies the maximum number of bytes to write.

Tips and Notes

Tip: This function is binary-safe. (This means both binary data, such as images, and character data can be written using this function.)


Example

The above code will output:


❮ Func Libxml Use Internal Errors Func String Strlen ❯