On 11/9/05 7:20 PM, GamblerZG wrote:
James Benson wrote:

Would it not be better something like valid_email()

email_validate()?

Anyway, I agree that PHP needs such function.

Check out http://pecl.php.net/package/filter

<?php
$clean['email'] = input_get(INPUT_POST, 'email', FL_EMAIL);
?>

I've been playing around with this for a while, and it should be noted that it's still in beta and should not be used in a production environment, but it's a promising step. The e-mail regex that's used isn't perfect, and it won't support RFC-compliant addresses, but I hope to put a little bit of work into it to help out with this.

In the meantime, check out PEAR::Mail, which includes Mail_RFC822 that can be used to validate e-mail addresses. Also, if your PHP is compiled --with-imap, then you can use imap_rfc822_parse_adrlist() to validate e-mail addresses.

--
Ben Ramsey
http://benramsey.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to