View Full Version : A word in a string

02-04-2007, 08: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?


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

02-05-2007, 06:05 AM
Thanks :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum