Re: Check if a word is in my string.
| From: | daniel james | Date: | Tue, 28 Aug 2001 22:11:25 +0000 |
| Subject: | Re: Check if a word is in my string. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64893@lists.php.net to get a copy of this message | ||
if you're just looking for the 1st occurrence of the
string, it's--
$check = "good";
$var = "This is a good...";
if (!strstr($var, $check)) {
print("$check not found");
}
also, i think strstr() is case-insensitive, so it
won't be able to differentiate between 'Good' and
'good', and will NOT return FALSE if 'Good' precedes
'good' in the string...
-dj
--- Brandon Orther <orther@webintellects.com> wrote:
> Hello,
>
> I have a variable with a string in it. I want to
> check if in that
> string a certain word is in it. Example
>
> $var = "This is a good sentence";
>
> $check = look("good", $var);
>
>
> and $check would equal 1 since "good" is in that
> string
>
>
>
>
> does anyone know how to do this?
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/