Check if string contains matched words.
- From: Eureka22 <name@xxxxxxxx>
- Date: Sat, 24 May 2008 16:03:33 +0200
On Sat, 24 May 2008 23:10:11 +1000, Leigh Finch <feiyang83@xxxxxxxxx> wrote:
J.O. Aho wrote:
Leigh Finch wrote:
if(strpos($string_to_match, rtrim($word)) !== false) {
$match = true;
}
It can be better to use stripos(), that way you haven't have to includ
in the file a million different ways to type the same word.
I do personally prefer to use trim(), you never know what another person
will do when they fill the file, could be they want to have some kind of
indentation.
Good points, this will make the search looser, and probably more accurate :)
Cheers
Leigh Finch
www.phpmaniac.net
Thanks for the tips. I changed to stripos ( case-insensitive) and trim()
Regards, Hans
.
- References:
- Check if string contains matched words.
- From: Eureka22
- Re: Check if string contains matched words.
- From: Leigh Finch
- Check if string contains matched words.
- From: Eureka22
- Re: Check if string contains matched words.
- From: Leigh Finch
- Re: Check if string contains matched words.
- From: J.O. Aho
- Re: Check if string contains matched words.
- From: Leigh Finch
- Check if string contains matched words.
- Prev by Date: Re: Check if string contains matched words.
- Next by Date: File Upload problem
- Previous by thread: Re: Check if string contains matched words.
- Next by thread: File Upload problem
- Index(es):
Relevant Pages
|