<?php
function obfuscateEmail(string $email): string {
$safe = '';
foreach (str_split($email) as $c) {
$safe .= rand(0, 1)
? '&#' . ord($c) . ';'
: '&#x' . dechex(ord($c)) . ';';
}
return '<a href="mailto:' . $safe . '">' . $safe . '</a>';
}
echo obfuscateEmail('hello@example.com');
// <a href="mailto:he...">he...</a>
//
// Renders as "hello@example.com" in browsers but most regex-based
// scrapers won't recognize it.
Create a free account and build your private vault. Share publicly whenever you want.