This article is about Text File Handling in PHP. Though now a days we generally use database and XML files for storage but there are still some scenarios in which we need file handling. Well, here are a couple of reasons why you might need to work with files: To move binary data (such as image files) into a database as BLOBs (Binary Large Objects) To import data (such as email addresses) that has been exported from a legacy database or application. To export data out of a database into a text file so that it can be processed offline Rest I am sure you will think of yourself :)!!! File functions in PHP are very similar to those found in the C++ fstream library. Like C++ we first open the file in Read/Write mode and then will actually Read/Write it. Opening a text file We open a file using fopen function. fopen stands for "file open", and is used to create a pointer to the file which we want to open for read/write access. It accepts 2 requir...