Created
May 27, 2024 22:18
-
-
Save w-jerome/22d695b7a0c507424025591a23645a70 to your computer and use it in GitHub Desktop.
[PHP] Email Obfuscation (spam killer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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