developer
developer

Reputation: 2050

replace text from an XML file using PHP?

I have an XML file which im fetching using php . That file contains '&' which gives error while fetching the file. Now i want to replace this "&" from my XML.How can i do that using php???

Upvotes: 0

Views: 2798

Answers (1)

Ilian Iliev
Ilian Iliev

Reputation: 3236

The simplest way is with string replace:

str_replace("&", "&", $xml_str);

http://php.net/manual/en/function.str-replace.php

Have in mind that if you have "&" in the xml they will become "&" So you can try:

str_replace("&", "&", $xml_str);
str_replace("&", "&", $xml_str);

Upvotes: 1

Related Questions