php - strpos with two words to find -


i found example on stackoverflow:

if (strpos($a,'are') !== false) {     echo 'true'; } 

but how make search 2 words. need this: if $a contains words "are" or "be" or both echo "contains";

i tried xor , ||

just check both words separately , use boolean or-operator check if either 1 or both contained in $a:

if (strpos($a,'are') !== false || strpos($a,'be') !== false) {   echo "contains"; } 

note due or-operator, second check (for 'be') not performed if first 1 showed $a contains 'are'.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -