Skip to main content

PHP File Handling: File Append

Body

In our previous tutorial we have learned how to open, close, read and write to a file. However, the ways which we wrote to a file so far have caused data that was stored in the file to be deleted. So in this lesson we’re going to deal on how to append to a file or to add on to the existing data, but we need to open the file in append mode.


To start with, this application and if we want to add on to a file we need to open it up in append mode. To do this, let’s create first a new file PHP file called “append.php”. And add the following code:
Take note, that when we were to write to a

Add new comment