> I have some text that outputs to a page without a variable, example:
echo
> "text";
> 
> the echo has text that I would like to preg_replace.
> 
> since there is no variable, is it possible to make a $dummy variable
so
> either way it replaces the text that i would like inside the echo?
> 
> this is the function that I'd like to use:
> 
> preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/si", "<a href=\\1
> target=_blank>\\2</a>");
> 
> How do I do this?

Use output buffering. Start the buffer before the echos, capture the
output, do the preg_replace, and display the result. More info on the
manual page.

http://www.php.net/manual/en/ref.outcontrol.php

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to