character encoding - What's the difference between these 2 functions in PHP? -
mb_convert_encoding($html,'html-entities','utf-8'); htmlentities($html); what's difference between 2 functions above?
from php.net:
mb_convert_encoding — convert character encoding
this converts passed string specified encoding type. in example, utf-8. html passed not escaped. link
htmlentities — convert applicable characters html entities
this means string passed in have of html tags escaped.
for example:
<b>this some</b> <a href="http://php.net">html</a> will become
<b>this some</b> <a href="http://php.net">html</a> when echoed screen, instead of being interpreted html. link 2
Comments
Post a Comment