0

I have this code:

$string = "Perfect Valentine's Day Care Package | SpouseBuzz.com";
echo $string ."\n";
echo html_entity_decode($string) ."\n";

And it returns:

Perfect Valentine's Day Care Package | SpouseBuzz.com
Perfect Valentine's Day Care Package | SpouseBuzz.com

My question is: why html_entity_decode is not converting the html entity?

Thanks!

1 Answer 1

3

html_entity_decode() by default will only convert double-quotes and will leave single-quotes alone. To also convert single-quotes to their corresponding character, add the ENT_QUOTES flag:

echo html_entity_decode($string, ENT_QUOTES, 'UTF-8');

Online demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.