note 93067 rejected from filter.examples.validation by danbrown

From: Date: Thu, 03 Sep 2009 19:25:36 +0000
Subject: note 93067 rejected from filter.examples.validation by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160206@lists.php.net to get a copy of this message
Note Submitter: codeblind dot php dot net at smithwebapps dot com ---- This filter may validate email addresses that are not always useful. In the example below "bar@example" returns as valid despite the lack of a top level domain and "baz@example.E1uA-wyE0" returns as valid despite having a random string for a tld. <?php $email_a = 'foo@example.com'; $email_b = 'bar@example'; $email_c = 'baz@example.E1uA-wyE0'; if ( filter_var($email_a, FILTER_VALIDATE_EMAIL) ) { echo $email_a . ' is considered a valid email address.<br />'; } if ( filter_var($email_b, FILTER_VALIDATE_EMAIL) ) { echo $email_b . ' is considered a valid email address.<br />'; } if ( filter_var($email_c, FILTER_VALIDATE_EMAIL) ) { echo $email_c . ' is considered a valid email address.<br />'; } ?>

« previous php.notes (#160206) next »