note 24475 deleted from function.ord by danbrown
| From: | danbrown@php.net | Date: | Tue, 11 Oct 2011 16:17:35 +0000 |
| Subject: | note 24475 deleted from function.ord by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183811@lists.php.net to get a copy of this message | ||
Note Submitter: merwetta_at_hotmail.com
----
In the notes for bin2hex, there is a function for hex encoding an email address in a
"mailto" tag to avoid spam bots. The hex encoding works in the anchor tag itself, but not
for the link text. To display the email address as the link text, you can use the function below to
ascii encode the address and keep the spam bots at bay.
function ascii_encode($string) {
for ($i=0; $i < strlen($string); $i++) {
$encoded .= '&#'.ord(substr($string,$i)).';';
}
return $encoded;
}