By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

preg_replace question

P: n/a

I want to turn the following:

<ref>Name & Name2, 1999</ref>


<a href="index.php?ref=Name + Name2, 1999">Name & Name2, 1999</a>

I now have to following code:

$text = preg_replace("/<ref>([^<]+)<\/ref>/m","<a

The problem is that &-sign are not converted to + sign. That is really
needed because & marks the end of the variable $ref

How can I improve this function so that the replacement works like I want it

- Daniel
Jul 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.