I have two strings "Mures" and "Maramures". How can I build a search function that when someone searches for Mures it will return him only the posts that contain the "Mures" word and not the one that contain the "Maramures" word. I tried strstr until now but it does now work.
You can do this with regex, and surrounding the word with word boundary
preg_match("~Mures~",$string)
example:
$string = 'Maramures'; if ( preg_match("~Mures~",$string) ) echo "matched"; else echo "no match";
1.4m articles
1.4m replys
5 comments
57.0k users