06-11-2009, 11:19 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Jun 2008
Posts: 8
Thanks: 0
|
Edit a file
Hi,
Please excuse if similar query has been posted earlier.
I have text file in which I have to search a word and replace it with a new word.
First I do is to get the file contents with fopen,then read the contents , maintain a string $newcontent that holds the contents of file ,the moment i get my word,replace it with new word in the string $newcontent
After that I write the whole string $newcontent to file again.
What I want is to just while scanning the file,the moment I find my word,replace it with new word there only instead of rewriting the whole file again.
Regards
|
|
|
|