Added: Dec 09, 2001
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo
A very short way to read a flat file and write to a flat file. this is similiar to having a counter on your site.
// open the file in read mode only
$fileread = fopen("file.txt", "r")Or die("Can't open file");
// Since fread() returns a string value, the last number
// of access read from the data file needs to be
//converted to an interger value (int) reading 10
//bytes from the data file.
$data = (int) fread($fileread, 10);
// closes the file
// adds 1 to the value
// open the file again in write access mode
$fileread = fopen("file.txt", "w") Or die("Can't open file");
// writes the data to the file
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.