...

View Full Version : A word in a string



b_hole
02-04-2007, 09:09 AM
I'm trying to check if a specific word exists in a specific string. For that I'm using strpos function, like this:

if (strpos($str, $word)==0) // do something

But this statement returns true also when $word is the first word in $str. How can I workaround this problem?

Thanks.

dumpfi
02-04-2007, 10:59 AM
if(FALSE === strpos($str, $word))
{
// $word is not in $str
}dumpfi

b_hole
02-05-2007, 07:05 AM
Thanks :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum