note 61511 added to function.fwrite

From: Date: Mon, 06 Feb 2006 01:24:15 +0000
Subject: note 61511 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-103062@lists.php.net to get a copy of this message
Hit counters? Well here's one I wrote: <?php if(($f = fopen("HitFile.txt","r+"))) { $Accessed = (int)fgets($f); $Accessed++; echo $Accessed; fseek($f, 0); fputs($f, $Accessed); fclose($f); } ?> works fine for me, but one thing I've been wondering about that I can't figure out is how to easily write to the beginning of a file and have the rest of the contents "push" down. So far I just read the contents into a variable using file_get_contents, and then write my newcontents.oldcontents to the file.. Surely there's an easier way, that's what I'm investigating now.. ---- Server IP: 216.235.15.211 Probable Submitter: 24.222.62.36 ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61511 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61511&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61511&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103062) next »