is it possible to use wildcard in an if statement? My code:
*=wildcard
if ($order_info=='Quatro*') {
}
$order_info will be "Quatro - na splátky", or "Quatro - čťžýáí"
Use regex:
if (preg_match('/^Quatro/', $order_info)) {
}
or strpos:
if (strpos($order_info, 'Quatro') === 0) {
}
Edit: Avoiding regex engine invocation for simple string matches like this is usually preferred. strpos
will do the same job less expensively.
Sure, use a regex:
if( preg_match( '/^Quatro.*/', $order_info))
{
}
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