php find multiple strings in string
if(preg_match('(bad|naughty)', $data) === 1) { }
php find multiple strings in string
if(preg_match('(bad|naughty)', $data) === 1) { }
string match in php
You could use regular expressions as its better for word matching compared to
strpos, as mentioned by other users. A strpos check for are will also return
true for strings such as: fare, care, stare, etc. These unintended matches can
simply be avoided in regular expression by using word boundaries.
A simple match for are could look something like this:
$a = 'How are you?';
if (preg_match('/\bare\b/', $a)) {
echo 'true';
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us