Re: Trying to build intelligent query from question
| From: | Peter J. Schoenster | Date: | Sun, 14 Jul 2002 18:07:34 +0000 |
| Subject: | Re: Trying to build intelligent query from question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107626@lists.php.net to get a copy of this message | ||
> > foreach($words as $Key=>$Value) {
> > if($ignoreWords[strtolower($Value)]) {
> > continue;
> > }
>
> You would be better off using array_diff().
Jason,
Thanks, that works except that it doesn't account for case. I want to ignore case as it
doesn't apply here. But I was able to get rid of the
associative array. So I reckoned it best to LC the question and copy it because I want to return the
original question as is back to the browser.
$_string = strtolower ($Config['input']['question']);
$words = explode(" ",$_string);
$ignoreWords =
array('brazil','like','the','this','that','why','are','there','where','find',);
$FindTheseWords = array_diff($words, $ignoreWords);
Peter