Email address obfuscator

This is a topic often ignored by most web designers and one that carries quite undesirable consequences. An email address on display to the world invites legitimate email as well as a whole truckload of spam - a never-ending torrent of junk emails.

Using a nice PHP function created by Ken Butcher, any mailto: link will be hidden from spambot crawlers but displayed to your human readers. nothing is foolproof, but this will stop some spam as it makes harvesting your email address just that bit harder...

The code is:

<?php
function createMailto($strEmail){
$strNewAddress = '';
for($intCounter = 0; $intCounter < strlen($strEmail); $intCounter++){
$strNewAddress .= "&#" . ord(substr($strEmail,$intCounter,1)) . ";";
}
$arrEmail = explode("@", $strNewAddress);
$strTag = "\n";
$strTag .= "');\n";
$strTag .= "document.write('" . $arrEmail[0] . "');\n";
$strTag .= "document.write('@');\n";
$strTag .= "document.write('" . $arrEmail[1] . "<\/a>');\n";
$strTag .= "// -->\n";
$strTag .= "" . $arrEmail[0] . " at \n";
$strTag .= str_replace("."," dot ",$arrEmail[1]) . "";
return $strTag;
}
?>

It is called using: <?=createMailto('me@myisp.com')?>

Can that spam!