PHP html decoding help - converting: A &#039;quote&#039; is <b>bold</b>

tzmatt7447 picture tzmatt7447 · Aug 26, 2010 · Viewed 53.2k times · Source

I need to convert a string like this:

A &#039;quote&#039; is <b>bold</b>

into:

A 'quote' is <b>bold</b>

html_entity_decode() did not work.

Answer

Robert Ros picture Robert Ros · Aug 26, 2010

Make sure you use the right quote_style:

html_entity_decode('A &#039;quote&#039; is <b>bold</b>', ENT_QUOTES);

ENT_QUOTES Will convert both double and single quotes. (PHP Manual: html_entity_decode)