Heres my code:
$string = 'It';
$string = html_entity_decode($string);
echo $string;
It should be echoing "It", but its just echoing the ASCII codes. Am I using the wrong function? I also tried htmlspecialchars_decode and it changes nothing.
Those are not valid entities Actually, they are valid in HTML 4 (and I suppose HTML5 too), but in this case the entities need to be semicolon-terminated for PHP to recognize them:
$string = 'It';
htmlspecialchars_decode()
only decodes <
, >
, &
, '
and "
(and the last two depend on the quotes flag).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With