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));
fclose($fp);


Regards,
Avetis

Mark Lo wrote:

> 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 (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to