Ouput escaping in my PHP (html tags render as is)

so I have text that is initially encoded as (instance)

<b>Location.</b><br /> <UL><LI>Park Central New York Hotel is located in New York, N.Y.

This data is taken from an XML file. Therefore, before processing it, I convert it to a simplexmlelement object, json_encode it (with parameter 1), and then json_decode. Ultimately, what I have in my hand for the above is the text I'm trying to do anyway.

<b>Location.</b><br /> <UL><LI>Park Central Ne

But the HTML tags do not display themselves and simply display themselves as they are seen above. I am a little confused which function I need to apply here to get the desired result.

Thank!

+3
source share
1 answer

You have double HTML encoded text. This line:

&amp;lt;b&amp;gt;Location.&amp;lt;/b&amp;gt;

will display like this when interpreting HTML:

&lt;b&gt;Location.&lt;/b&gt;

, , , html_entity_decode, :

<b>Location.</b>

, .

+6

All Articles