I'm trying to detect if the user has a google domain. But it is always returning true.
if($emdomain == "google.com" || "gmail.com") {
array_push("google domain");
} else {
array_push("not google domain");
}
I'm trying to detect if the user has a google domain. But it is always returning true.
if($emdomain == "google.com" || "gmail.com") {
array_push("google domain");
} else {
array_push("not google domain");
}
Basic grammar error, your
if($emdomain == "google.com" || "gmail.com")
actually equals to:
if(($emdomain == "google.com") || "gmail.com")
And ( Anything || "gmail.com" ) will give True
, since a string is True
as boolen.
That's why it gives you first value every time.
The thing you wanted to do is:
if($emdomain == "google.com" || $emdomain == "gmail.com")
If $emdomain == "google.com"
is a true value, then the if
will be true.
Otherwise, if gmail.com"
is a true value, then the if
will be true. The string "gmail.com"
will always be a true value.
Presumably the test you are trying to run is:
if ($emdomain == "google.com" || $emdomain == "gmail.com")