"Mark Lo" <[EMAIL PROTECTED]> wrote:
> 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.
In addition to the solution mentioned using PHP filesystem functions, you
could use Unix command like grep, sed
Hello,
something like this:
$filename="your_file_name.txt";
$fp = fopen($filename, "r+") or die ("Could not open file");
$content = fread ($fp, filesize($filename));
$new_content = str_replace("old_word", "new_word", $content);
rewind($fp);
fwrite($fp, $new_content);
ftruncate($fp, ftell($fp));
f
Hi,
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..
Thank you
Mark
--
PHP General Mailing List (ht
3 matches
Mail list logo