Jump to content

Input Validation in the PHP Manual


Glese

Recommended Posts

Validating an email is that easy nowadays? Did I understand right, all I have to do is:

 

filter_var($email, FILTER_VALIDATE_EMAIL);

 

 

Is this accurate, the way how I have understood it?

 

How can I tell, what FILTER_VALIDATE_EMAIL finally is doing or how exactly it is filtering, does documentation state this somewhere?

Link to comment
Share on other sites

How can I tell, what FILTER_VALIDATE_EMAIL finally is doing or how exactly it is filtering, does documentation state this somewhere?

 

The internal workings generally aren't documented, and what exactly this email validation accepts as valid would take a lot of describing (though it would be nice to have this).  This email validation simply uses a regular expression. The exact regular expression used has changed over time since FILTER_VALIDATE_EMAIL was introduced, but you can see it in the PHP source code.  Here it is for the upcoming PHP 5.4, http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/filter/logical_filters.c?view=markup#l499

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.