String Replacement with PHP - urgent.
Posted: Sun Aug 04, 2002 12:57 am
Hey there.. wondering if any one can help..
i have a large block of XML in a file that i wish to search through, find 2 strings (container tags) , then replace the xml in between the containers. I don't really want to have to parse the XML (as i already have it all in a multidimensonal array, but do not want to have to format it all for each container cause there are a lot - i'd rather "cheat" and just replace what i need to)
Any ideas on how to do it? Can PHP's string functions look for 2 strings, and replace what's in between them with what might be a long string?
eg.
<container>
<stuff></stuff>
<i></i>
<need></need>
<replaced></replaced>
</container>
Thanks to anyone who can help.. i really am stressing a little and might be missing something that is probably easy.
Cheers
i have a large block of XML in a file that i wish to search through, find 2 strings (container tags) , then replace the xml in between the containers. I don't really want to have to parse the XML (as i already have it all in a multidimensonal array, but do not want to have to format it all for each container cause there are a lot - i'd rather "cheat" and just replace what i need to)
Any ideas on how to do it? Can PHP's string functions look for 2 strings, and replace what's in between them with what might be a long string?
eg.
<container>
<stuff></stuff>
<i></i>
<need></need>
<replaced></replaced>
</container>
Thanks to anyone who can help.. i really am stressing a little and might be missing something that is probably easy.
Cheers