Re: writing to a file

From: Date: Fri, 23 Mar 2001 02:37:45 +0000
Subject: Re: writing to a file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45237@lists.php.net to get a copy of this message
On Fri, 23 Mar 2001 12:39, adam wrote: > how might i write to a file called "comment.php.comment" and only write > the text specified to the top of the file, instead of writing it to the > bottom? You need several steps to achieve this: read all of comment.php.comment into an array open a temp file to write write the 'text specified' to the temp file write the array from comment.php.comment to the temp file once you're happy all is written, close open temp file rename temp file to comment.php.comment The functions you need for this can be found in the Filesystem section of the docs. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#45237) next »