I have a php code that creates an XML and it works fine, but it messes up the & and converts it to &
I use this code to put my url into the xml:
htmlentities($final_url);
and when xml file is opened, it shows
index.php?route=product/product&path=37&product_id=1101515800&pdescription
How can I format it properly?
The code is working correctly. An ampersand in XML must always be encoded as
&. You don’t need to worry about it, because anyone reading the file using an XML parser will have it automatically decoded as&. The only time you need to worry is if someone is reading the file without using a real parser (e.g. using a regex) and regular followers of this forum will know that is a very dangerous thing to do.