What is the fastest way to build a description from allot of text based off of keywords. Basically, I am looking for a description like in the google results.
I used a preg_match statement, but it can be extremely slow when you use more than one keyword.
For Example:
if(preg_match( "/\b(\b\w+\W+){0,10}\b($item)\b(\W+\w+\b){0,10}\b/i", $text, $match )) { $desc .= $match[0] . "...";}