Is it possible to use a wildcard in an if statement?
My code:
*
= wildcard
if ($admin =='*@some.text.here') {
}
$admin
will be one of these:
If you don't want to use regular expressions, fnmatch()
might serve you well for this [limited] purpose. It matches strings using shell-like wildcards like you are expecting.
if (fnmatch('*@some.text.here', $admin)) {
}
You could just check that the string ends with the value you are expecting:
$suffix = '@some.text.here';
if (substr($admin, -strlen($suffix)) == $suffix) {
// Do something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With