Digital Colony!

Masking Email Addresses in PHP

Steve Waag from Lacanche Ranges was able to translate the ASP in Masking Your Email Address to PHP.
<?php
function maskEmail($email) {
  $maskedEmail = '';
  for ($j = 0; $j < strlen($email); $j++) {
    $maskedEmail .= '&#' . ord(substr($email, $j, 1)) . ';' ;
  }
  $emailHtml = '<a href="m&#' . ord('a') . ';&#' . ord('i') . ';&#' . ord('l')
    . ';&#' . ord('t') . ';o:' . $maskedEmail . '">' . $maskedEmail . '</a>';
  return $emailHtml;
}
?>

<p>For more information email me at
  <?php echo maskEmail('someEmail@someDomain.net') ?>.</p>

Labels: , ,

AddThis Social Bookmark Button

0 Comments:

 

Post a Comment

 

Digital Colony Copyright © 1999-2008 XHTML   508
This site uses Blogger, which is not 100% XHTML compliant.
Try...Catch Disclaimer: For brevity many examples do not include error handling. That is your responsibility.