E-Mail Validation
$email = 'testuser@gmail.com'; if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "This ($email) email address is considered valid."; } else { echo "This ($email_a) is valid Email."; }
URL Validation
$url = "http://www.test.com"; if(filter_var($url, FILTER_VALIDATE_URL)) { echo "$url is valid URL"; } else { echo "$url is invalid Valid URL"; }
IP Validation
$ip = '127.0.0.1'; if (filter_var($ip, FILTER_VALIDATE_IP)) { echo "This ($ip) IP address is considered valid."; } else { echo "This ($ip) IP address is considered invalid."; }