Is it possible to match two words that might come in random sequences? Examples:
$title = \"2 pcs watch for couple\";
$title = \"couple watch 2 pcs\";
If you're just testing for the presence of the two words in the string you could use
'/couple.*2 pcs|2 pcs.*couple/'
use strpos()
if(strpos($string, '2 pcs') !== False){
//its found
}
or matching at first and at end
if(preg_match("/(^(2 pcs|couples)|(2 pcs|couples)$)/", '2 pcs watch for couples')){
//echo "found";
}
or
Matching anywhere:
if(preg_match("/(2 pcs|couples)/", '2 pcs watch for couples')){
//echo "found";
}