PHP Valid Email


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



Copy this code and paste it in your HTML
  1. error_reporting( E_ALL );
  2.  
  3. function is_valid_email( $email )
  4. {
  5. return preg_match( '/[.+a-zA-Z0-9_-]+@[a-zA-Z0-9-]+.[a-zA-Z]+/', $email );
  6. }
  7.  
  8. $emails = array( 'br0k3n',
  9.  
  10. foreach( $emails as $email )
  11. {
  12. echo $email . ' is' . ( is_valid_email( $email ) ? '' : ' not' ) . " valid\n";
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.