Quick and easy way to validate email strings. I picked this bit of code up from somewhere, not sure where….Think it was the Zend site. Credit goes to the original unknown author, not me.

<?php
function is_email($address) {
$rc1 = (ereg(‘^[-!#$%&’*+./0-9=?A-Z^_`a-z{|}~]+’.
‘@’.
[-!#$%&’*+\/0-9=?A-Z^_`a-z{|}~]+.‘.
[-!#$%&’*+\./0-9=?A-Z^_`a-z{|}~]+$’,
$address));
$rc2 = (preg_match(‘/.+.ww+$/’,$address));
return (
$rc1 && $rc2);
}
?>



No Responses to “Quick and easy PHP function to Validate email strings.”  

  1. No Comments

Leave a Reply