I usually checked this with the following code:
$email = '/[^@:="\'\s]*@[^@\s]*\.[a-z]+/iU';
if(preg_match($email,$article->text) == true) {
to something
}
In PHP 8 this is deprecated (Works, but with warning), because I can't always guarantee that there really is an email in it.
Passing null to parameter #2 ($subject) of type string is deprecated
What are the alternatives?
I know that this solution still works, but I want to be fit for the future.
When searching, I did not find a solution. "str_contains" seems to allow only one string.