Make your own free website on

Visit the Official PHP Website

Search this Site

PHP Programming

By James N Hitz

File Management Functions

PHP provides a myriad of functions for manipulating files. We'll not use all of them here but we'll cover enough to set the ball rolling.

Amongst them all, the most useful include:

	fopen ("filename","mode")
	fclose ($filehandle)
	fwrite ($filehandle,"strings to write")
	copy ("source_file", "destination_file")
	unlink ("filename")
	array file("filename")
	file_exists ("filename")
	is_dir ("filename")
	is_file ("filename")
	rename("oldname", "newname")

These are just some. As I said there are more! Don't worry right now if they look intimidating. At the end of it all you'll be smiles. Ok!

As a basic requirement, you should be able to open files, read and output their contents, and close them successfully reporting errors if and when they occur. Let's see how to do this.

<< File Management | Opening and Closing Files >>

JamHitz Productions