Fastest PHP Routine To Match Words
Posted
by Volomike
on Stack Overflow
See other posts from Stack Overflow
or by Volomike
Published on 2010-04-13T20:25:49Z
Indexed on
2010/04/14
0:03 UTC
Read the original article
Hit count: 242
What is the fastest way in PHP to take a keyword list and match it to a search result (like an array of titles) for all words?
For instance, if my keyword phrase is "great leather shoes", then the following titles would be a match...
- Get Some Really Great Leather Shoes
- Leather Shoes Are Great
- Great Day! Those Are Some Cool Leather Shoes!
- Shoes, Made of Leather, Can Be Great
...while these would not be a match:
- Leather Shoes on Sale Today!
- You'll Love These Leather Shoes Greatly
- Great Shoes Don't Come Cheap
I imagine there's some trick with array functions or a RegEx (Regular Expression) to achieve this rapidly.
© Stack Overflow or respective owner