note 29929 added to function.htmlentities

From: Date: Sat, 01 Mar 2003 02:12:36 +0000
Subject: note 29929 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-44683@lists.php.net to get a copy of this message
This function will encode everything, either using ascii values or special entities: function encode_everything($string){ $encoded = ""; for ($n=0;$n<strlen($string);$n++){ $check = htmlentities($string[$n],ENT_QUOTES); $string[$n] == $check ? $encoded .= "&#".ord($string[$n]).";" : $encoded .= $check; } return $encoded; } so you can use: $emailAddress = encode_everything($emailAddress); to protect an email address - although I imagine it's not a great deal of protection. -- http://www.php.net/manual/en/function.htmlentities.php http://master.php.net/manage/user-notes.php?action=edit+29929 http://master.php.net/manage/user-notes.php?action=delete+29929 http://master.php.net/manage/user-notes.php?action=reject+29929

« previous php.notes (#44683) next »