email

PHP Logo

Mask Email With ASCII Character Codes In PHP

28th April 2008 - 2 minutes read time

Hiding your email address in an image is the best way of encrypting your email, but if your server doesn't support the GD2 library, or if you don't want to use it, then you might want to look at a different way of doing this.

The easiest way to encrypt your email address is to turn every character into the ASCII code equivalent and use this to display the text in HTML by putting a in front of each character. Here is a function that takes a string and turns it into HTML encoded text.