How can PHP be used to validate email addresses by checking for the presence of "@" and "."?

To validate email addresses using PHP, we can check for the presence of "@" and "." in the email string. This basic validation can help ensure that the email address has the correct format before further processing or storing it.

$email = "example@example.com";

if (strpos($email, "@") !== false && strpos($email, ".") !== false) {
    echo "Email address is valid.";
} else {
    echo "Invalid email address.";
}