Zoran Lorkovic wrote:

Sorry for issuing this again, but I need help with preg_replace. I manage to replace certain text between 
<b></b> in text with preg_replace but I want for every other <b></b> to be replaced by 
other text.
By this I mean when some text between <b></b> has been found that text is replaced with some Text, 
on second match, text between <b></b> is replaced by some other different text etc.

Btw, where I can find patterns that are valid?
(something like (\w+), (\d+)+i etc.

Use preg_replace_callback() with a static variable within the callback function. Increment the variable each time the function is called and then based upon whether it's odd or even, substitute the appropriate string.


--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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



Reply via email to