RE: [PHP] replacing everything between 2 strings
| From: | Daryl Meese | Date: | Tue, 22 Jul 2003 00:09:10 +0000 |
| Subject: | RE: [PHP] replacing everything between 2 strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156164@lists.php.net to get a copy of this message | ||
look into opendir and readdir
with opendir you can open a handle to a directory and use readdir in a loop
to look at every file (fopen or whatever to load each file) then parse your
files. readdir may help you verify the files you are working on at least
have the right extension.
Daryl
-----Original Message-----
From: Matt Palermo [mailto:mpalermo@vt.edu]
Sent: Monday, July 21, 2003 6:52 PM
To: php-general@lists.php.net
Subject: [PHP] replacing everything between 2 strings
Is there a way to replace everything between 2 given strings if it
exists? Say I have:
$str = "replace anything and everything in here.";
Now I want to replace everything between the word "replace" and "here.",
so the new string could read something like this:
$str = "replace NOTHING here.";
So it keeps the two end points but just replaces everything in the
middle with a new specified string. Please help me if you can. Thanks.
Matt