note 22960 added to function.fwrite

From: Date: Fri, 05 Jul 2002 09:11:14 +0000
Subject: note 22960 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-32629@lists.php.net to get a copy of this message
My personal attempt at using PHP to build a page counter using file access ops, rather than a database. I hope this useful to someone else...very very very basic and no exception checking! # # Builds a basic page counter using a text file! # # Filename $cnt_file = "count.txt"; # Read single line into a string $string = implode("", file($cnt_file)); # Print the value echo $string; # Add one to current value $string++; # Open file for write, no append! $tmpfile = fopen($cnt_file,"w"); # Write the new value back to the string $fp = fwrite($tmpfile,$string); # Close file fclose($tmpfile); -- http://www.php.net/manual/en/function.fwrite.php http://master.php.net/manage/user-notes.php?action=edit+22960 http://master.php.net/manage/user-notes.php?action=delete+22960 http://master.php.net/manage/user-notes.php?action=reject+22960

« previous php.notes (#32629) next »