Clean up and normalize email address


/ Published in: PHP
Save to your folder(s)

Requires PHP 5.2 with filter_var()


Copy this code and paste it in your HTML
  1. function cleanAddress($address)
  2. {
  3. return filter_var(strtolower(trim(preg_replace('/\\s+/', '', $address))), FILTER_SANITIZE_EMAIL);
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.