How in php to check for the input fields with e-mail and phone?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
6 views
What the regular expression should be zayuzat and how to do it in PHP for validation e-mail and phone?

if $mail != $regexp?

Mail it is necessary to determine the presence of dogs and points.
phone by the presence of numbers and special. characters (parentheses, dashes, and spaces, letters can not)

Please help the website need to pass in the morning, not sleep all night, now to learn once.
In Google found nothing good, but maybe just sleepy.
by | 6 views

4 Answers

0 like 0 dislike
Check email:
\r
if (preg_match('/[^(\\w)|(\\@)|(\\.)|(\\-)]/', $email)) ... 

\r
Phone verification:
\r
if (preg_match('/((8|\\+7)-?)?\\(?\\d{3,5}\\)?-?\\d{1}-?\\d{1}-?\\d{1}-?\\d{1}-?\\d{1}((-?\\d{1})?-?\\d{1})?/', $phone)) ... 

\r
Can find almost any regular season here.
by
0 like 0 dislike
if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
die("Incorrect email!");
by
0 like 0 dislike
Solsuite filters. They are faster and simpler regular expressions.
by
0 like 0 dislike
if (preg_match("/^[a-za-Za-zA-Z0-9_\\.\\-]+@[a-za-Za-zA-Z0-9\\-]+\\.[a-za-Za-zA-Z\\-\\.]+$/Du", $email) > 0) { // to do }
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
110,608 questions
257,186 answers
0 comments
27,966 users