If I have a string that equals "firstpart".$unknown_var."secondpart", how can I delete everything between "firstpart" and "secondpart" (on a page that does not know the value of $unknown_var)?
Thanks.
Neel
start and length can be computed with strpos. Or you could go the regex route if you're comfortable learning about them. |
|||||||||||||||||||||
|
As long as
and replace it with
|
|||
|
You shoukd use a regexp to do so.
will replace anything between the first occurence of firstpart and the last of secondpart, if you want to delete multiple time between first and second part you can make the expression ungreedy by replacing
|
|||
|
$unknown_var
– Dor Jul 26 '11 at 23:22