As Gordon said, URIs are encoded this way. If you have not encoded & to & , the XML file will be corrupted - you will get errors parsing it. When you take a string back from an XML file, if & is still displayed, or str_replace() looks like this:
$str = str_replace('&', '&', $str)
Or use htmlspecialchars_decode() :
$str = htmlspecialchars_decode($str);
The added bonus of using htmlspecialchars_decode() is that it will decrypt any other HTML code that may be in the string. See here for more details.
source share