Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Htmlentities - double encoded

What condition we use to decide when to set double encoded is true or false? What php settings variable we can use to decide it?

For Russian character, it should use double encoded true then it will display the character. But if double encoded is false, the string will be displayed as empty. What condition we use to set double encoded true or false?

like image 347
Julianto Avatar asked May 05 '26 20:05

Julianto


1 Answers

You can change that with the 4th argument. Set it to FALSE to not double encode.

$str = 'Hot & Cold and On & Off';

var_dump(htmlentities($str, ENT_COMPAT, 'UTF-8', FALSE));

Output

string(31) "Hot & Cold and On & Off"

CodePad.

like image 105
alex Avatar answered May 08 '26 12:05

alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!