How can the content of a variable be searched for the presence of an @ symbol in PHP?

To search for the presence of an @ symbol in the content of a variable in PHP, you can use the strpos() function which returns the position of the first occurrence of a substring in a string. If the @ symbol is found in the variable content, the function will return a non-false value indicating its position in the string. You can then check if the returned value is not false to determine if the @ symbol is present.

// Variable containing content to be checked
$content = "example@email.com";

// Check if the @ symbol is present in the content
if (strpos($content, '@') !== false) {
    echo "The content contains the @ symbol.";
} else {
    echo "The content does not contain the @ symbol.";
}