Re: replace function in a file.

From: Date: Thu, 19 Apr 2001 16:41:00 +0000
Subject: Re: replace function in a file.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49387@lists.php.net to get a copy of this message
On 4/19/2001 11:59 AM this was written: > Is there any function exists which to open a specific file, then find a > specific word, if found, then replace that word with something else. > > re: I know fopen is to open, read, and write to specific file, but not > finding and replacing.. Unless someone knows something I don't, the only way I can think of is: rename file to backup Open 'infile' backup Open new outfile (original) Go through each line reading from infile writing to outfile until you find the word on the line. Then do a string replace for that line and write the new line. Continue this way thoughout the file until the end. -- Thomas Deliduka IT Manager ------------------------- New Eve Media The Solution To Your Internet Angst http://www.neweve.com/

« previous php.general (#49387) next »