如何在 PHP 中检查重复的电子邮件地址,考虑到 Gmail 自动标签和标点符号的可能性吗?
例如,我希望这些地址被检测为重复:
[email protected]
[email protected]
[email protected]
[email protected]
尽管 Daniel A. White 声称:在 Gmail 中,“@”(和标签)之前随机位置的点可以随意放置。用户。[电子邮件受保护] and [电子邮件受保护]实际上是同一个用户。
$email_parts = explode('@', $email);
// check if there is a "+" and return the string before
$before_plus = strstr($email_parts[0], '+', TRUE);
$before_at = $before_plus ? $before_plus : $email_parts[0];
// remove "."
$before_at = str_replace('.', '', $before_at);
$email_clean = $before_at.'@'.$email_parts[1];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)