1<?php
2 function checkemail($str) {
3 return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
4 }
5 if(!checkemail("alex@tutorialspoint.com")){
6 echo "Invalid email address.";
7 }
8 else{
9 echo "Valid email address.";
10 }
11?>