Skip to content Skip to sidebar Skip to footer

Php Html_entity_decode Doesn't Decode Entity As Expected?

In the following code: $string1 = 'function doesn't work as expected'; $string2 = html_entity_decode($string1); $string2 still contains: ' ...after the call to

Solution 1:

The default flags for html_entity_decode do not include single quotes. Try updating your flags argument to include ENT_QUOTES and ENT_HTML5:

$string1 = "function doesn't work as expected";
echo $string2 = html_entity_decode($string1, ENT_QUOTES|ENT_HTML5);
// function doesn't work as expected

Post a Comment for "Php Html_entity_decode Doesn't Decode Entity As Expected?"