Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 55
Viewed: 4565
Added: Dec 09, 2001
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

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.

Replying to a Comment...

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.

© 2002 - 2018 All Rights Reserved. Conditions