FILTER_VALIDATE_EMAIL 過濾器把數值當作e-mail 位址來驗證。
Name: "validate_email"
ID-number: 274
<?php$email = "someone@exa mple.com";if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "E-mail is not valid"; }else { echo "E-mail is valid"; } ?>
程式碼的輸出如下所示:
E-mail is not valid