PHP Append to File

You can append data into file by using a or a+ mode in fopen() function. Let’s see a simple example that appends data into data.txt file.

Let’s see the data of file first.

data.txt

PHP Append to File – fwrite()

The PHP fwrite() function is used to write and append data into file.

Example

Output: data.txt

Spread the love

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *