views:

30

answers:

1

How do I replace ampersands in a url from & > &

I use some rss feeds witch has URL containing & should I use

$link = str_replace('&', '&', $link);

or there are other options?

+4  A: 

Use htmlspecialchars. It replaces not just & but also ", <, >, and ' (only if quote_style parameter is set to ENT_QUOTES) that all need to be replaced with appropriate character references.

Gumbo