Lets suppose I have a string:
$text = "This is my string exec001 and this is the rest of the string exec222 and here is even more execSOMEWORD a very long string!"
I want to replace each occurrence of "exec?" in the string with some new text and at the same time I want to store the text that follows "exec" in a separate variable so it can be used when replacing the text.
For example, say I want to replace each occurrence of exec??? with, < html>???< /html>< div>???< /div> , so that the resulting string is:
$text2 = "This is my string <html>001</html><div>001</div> and this is the rest of the string <html>222</html><div>222</div> and here is even more <html>SOMEWORD</html><div>SOMEWORD</div> a very long string!"
How can I do this in PHP?
Thanks very much in advance.