Visit the Official PHP Website
By James N Hitz
File Management in PHP
File management is the ability to open, edit, save and create files. We have all been using files. This document is a file, the letters, accounts and memos in your computer's hard disk are files, the picture of Linus Torvalds at Altavista is a file. Good Heavens!! Files, files everywhere and not a file to... drink?
In this lesson, we'll learn how to manipulate files. An accomplished programmer should! May be beginners may be naive enough to ask, "Why would I want to open files anywayz?"
There are many situations that would warrant usage of files. The following are just a few examples:
Creating a guestbook:- user types in their names, email address and comments about your website; your script accepts these inputs and saves them into a file; in future visitors can open these files to view the comments.
Creating a counter:- user logs into your web site; the documents opens a file, reads the counter value there-in; increments the counter value by one and saves it again.
Online tests:- user logs into your website, questions are presented, users choose answers; their answers are saved.
Well... As you can see, there are a million and one ways of using files. So lets' get with it.