How do you force PHP "htmlentities" to convert a special character to the entity number rather than to the entity name?
For example, convert É to É rather than to É
I have searched with no answers.
How do you force PHP "htmlentities" to convert a special character to the entity number rather than to the entity name?
For example, convert É to É rather than to É
I have searched with no answers.
You don't can force PHP "htmlentities" to convert a special character to the entity number rather than to the entity name. Take a user function.
function htmlEntityNumber($char){
$utf32char = mb_convert_encoding($char,"UTF-32BE","UTF-8");
return "&#".unpack("N",$utf32char)[1] . ";";
}
//var_dump and echo only show an É
debug::write(htmlEntityNumber('É'));
//string(5) ASCII "É"