fwrite

File I/O in PHP

Introduction: This tutorial is on how to perform file I/O in PHP. I/O? I/O stands for Input/Output, and means writing/reading to/from files on the system. PHP Tags: First we need three things; The file you want to write the contents to - this can be pre-existing, or not. The contenst to write to the file. The default PHP tags, ready to write our PHP code. Here are the PHP tags, in which we will write our code...
  1. <?php

PHP File Handling: File Append

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”.