The Javascript splits it up nicely. Trouble with PHP's explode is that it is a superficial action as the email will still be printed in basic HTML - all together. In my PHP example above, you would do something like the following for your link:
Code:
<a href="mail.php?txtMail=adam">Email Adam</a>
It would then call the file with my code contained in it. If all goes well then the header function will relay the end user onto their default email client and open up a new email with the recipient set as the email address I specified in my PHP code under
adam. That way the email addresses aren't exposed.
The PHP way is the more efficient method and also the method that will be more widely supported by many browsers. Most browsers, unless you explicitly tell them not to, redirect from the
location attribute in the HTTP header response. Whereas, people know how to turn Javascript off with ease
(And some browsers do not support Javascript), but disabling the HTTP header is something most people would not know how to do - nor actually want to.
Read my header tutorial for further information.
Bottom line? PHP method beats the Javascript method hands down!