A kick-ass email obfuscator, based on my obfuscate_email()
PHP function. This tool will encode (HTML) and/or reverse (CSS) any email address you enter, making it less vulnerable to spammers who use e-mail harvesting software aka spambots.
function obfuscate_email($email, $encode = 1, $reverse = 0, $before = '<span class="email">', $after = '</span>') {
$output = '';
if ($reverse) {
$email = strrev($email);
$output = $before;
}
if ($encode) {
for ($i = 0; $i < (strlen($email)); $i++) {
$output .= '' . ord($email[$i]) . ';';
}
} else {
$output .= $email;
}
if ($reverse) {
$output .= $after;
}
return $output;
}
— Mathias