Skip to content

Instantly share code, notes, and snippets.

@w-jerome
Created May 27, 2024 22:18
Show Gist options
  • Save w-jerome/22d695b7a0c507424025591a23645a70 to your computer and use it in GitHub Desktop.
Save w-jerome/22d695b7a0c507424025591a23645a70 to your computer and use it in GitHub Desktop.
[PHP] Email Obfuscation (spam killer)
<?php
function emailObfuscation(string $email) {
return preg_replace_callback('/./', function($m) use ($email) {
return '&#' . ord($m[0]) . ';';
}, $email);
}
echo emailObfuscation('myemail@example.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment