Here’s a simple piece of code that performs PHP based email obfuscation to replace standard characters with an ASCII encoded alternative.
This technique, although simple, will block some of the less intelligent spiders/robots out there. There are many other techniques including using JavaScript to render email address or images or even reversing the email address through CSS, however they all have their pros and cons and remember there isn’t an solution.
<?php
function email_obfuscator( $email )
{
$strArray = str_split( $email );
$obfEmail = '';
foreach( $strArray as $char )
{
$obfEmail .= '&#'.ord( $char );
}
return $obfEmail ;
}
echo '<a href="mailto:'.email_obfuscator('test@test.com').'">'.email_obfuscator('test@test.com').'</a>';
?>


1 Comment Received
Wow, thanks didn’t know about this one!
Leave A Reply