Hi,

I am sorry if this problem is too easy but I just can't figure out a way to
do this.

I am making a search engine and I would have the user to type a sentence to
search for.

Let's say it is stored in $search.

My search enginue will bring up a result IF and only if ALL of the words in
$search exist in the result.  For example
if 

$search = Vax Useful Commands

Then the result is only true if (eregi(".*Vax.*Useful.*Commands.*",
'possible result')) is true

Now, I don't know how many words there are in $search initially.  How do I
do a search like that?  I mean if I know $search is 3 words then I can do

$words = preg_split("/  /", $search);

if (eregi(".*words[0].*words[1].*words[2].*", 'possible result')) {
 .....
}


Even if I know how many words there are, everytime the number of words in
$search can be different.

Can anybody give me any ideas?
Thanks a lot

Kelvin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to