note 85884 added to function.htmlentities

From: Date: Mon, 22 Sep 2008 23:47:01 +0000
Subject: note 85884 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-144629@lists.php.net to get a copy of this message
use htmlspecialchars() if you are passing in a usual ASCII string. It is faster than htmlentities(). For example, if you are just doing htmlentities('<div style="background: #fff"></div>'); then you can just use htmlspecialchars(). htmlentities() will look for all possible ways to convert string into html entities, such as &copy; or &eacute; (which is e with an acute accent on top). Note that ASCII is just 7 bit, which is 0x00 to 0x7F. htmlspecialchars() will handle characters inside this range already. htmlentities() is for the 8-bit Latin-1 (ISO-8859-1) to handle European characters, or for UTF-8 when the 3rd argument is "UTF-8" to handle UTF-8 characters, or other types of encodings using different values for the 3rd argument passed into htmlentities(). ---- Server IP: 69.147.83.197 Probable Submitter: 99.182.233.78 ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- https://master.php.net/note/edit/85884 Del: integrated -- https://master.php.net/note/delete/85884/integrated Del: useless -- https://master.php.net/note/delete/85884/useless Del: bad code -- https://master.php.net/note/delete/85884/bad+code Del: spam -- https://master.php.net/note/delete/85884/spam Del: non-english -- https://master.php.net/note/delete/85884/non-english Del: in docs -- https://master.php.net/note/delete/85884/in+docs Del: other reasons-- https://master.php.net/note/delete/85884 Reject -- https://master.php.net/note/reject/85884 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144629) next »