note 24475 added to function.ord
| From: | merwetta_at_hotmail.com@php.net | Date: | Sat, 17 Aug 2002 13:01:57 +0000 |
| Subject: | note 24475 added to function.ord | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35169@lists.php.net to get a copy of this message | ||
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;
}
--
http://www.php.net/manual/en/function.ord.php
http://master.php.net/manage/user-notes.php?action=edit+24475
http://master.php.net/manage/user-notes.php?action=delete+24475
http://master.php.net/manage/user-notes.php?action=reject+24475