[SOLVED] Serious preg_replace headache .. help!!
Posted: Sat Oct 16, 2004 12:31 pm
Ok, what I am "trying" to do is replace a string in a text file with a function. Got that part kind of working, but the results are not in the correct order.
Now my text I am pulling from the DB is something like this:
It replaces and called the function, but it puts the results of the replace above everthing else ... so I get:
Thanks in advance!
Tim
Code: Select all
function replaceTest() {
print "This is a test - YO";
}Code: Select all
$page['page_text'] = preg_replace('#\[replace]#i', replaceTest(),$page['page_text']);Code: Select all
<div>This this the top ...</div>
<div>&nbsp;</div>
<div>їreplace]</div>
<div>&nbsp;</div>
<div>This is the bottom</div>Any ideas on how to get the function to call in the correct place??This is a test - YO
This this the top ...
This is the bottom
Thanks in advance!
Tim