What are some potential pitfalls when using substr_count() to check for the presence of an "@" symbol in an email address?

When using substr_count() to check for the presence of an "@" symbol in an email address, a potential pitfall is that it will count all occurrences of the "@" symbol in the string, which may not accurately determine if it is a valid email address. To solve this issue, you can simply check if the count is equal to 1 to ensure there is only one "@" symbol in the string.

$email = "example@example.com";

if(substr_count($email, "@") == 1){
    echo "Valid email address";
} else {
    echo "Invalid email address";
}