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?
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?
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.