Re: replace function in a file.
| From: | Steve Werby | Date: | Thu, 19 Apr 2001 16:52:42 +0000 |
| Subject: | Re: replace function in a file. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49388@lists.php.net to get a copy of this message | ||
"Mark Lo" <mark@3dsources.com> 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, etc. called from within your PHP
script to accomplish this. Or you could use a search and replace program
like rpl (happens to be free) which you can download from
http://www.laffeycomputer.com/rpl.html.
rpl's syntax is very simple - "rpl
'old_string' 'new_string' filename" and you can call it using one of the
program execution functions or by enclosing it within backticks.
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/