I am trying to write some php code to check if a name is contained in another (boolean method).
I am currently using strpos to determine if str1 is in str2, however i want it to be a little smarter. i.e. only check if the str1 exists by itself and not part of another unrelated name/string.
compareStrings(str1,str2)
e.g.
GAP & THISISNOTAGAP //should return false
GAP & IN THE GAP //should return true
GAP & GAP //shop return true
ROSS & CROSSROADS //should return false
ROSS & ROSS - CHICAGO //should return true
Any ideas if there is a built in function or regex i can use to achieve above? Thanks.