fseek($handle, 0) ;
//Puts the pointer back to the begining of the file
fwrite($handle, $count) ;
//saves the new count to the file
fclose($handle) ;
//closes the file
?>
This code starts by returning the pointer to the start of our file. If we don't do this, we'll just be tacking numbers onto the end of our current number, and not actually overwriting the count. Once we are at the start of the file, we use fwrite () to overwrite the old count with the new one, so it is ready for the next visitor.