Re: Check if a word is in my string.
| From: | Papp Gyozo | Date: | Tue, 28 Aug 2001 23:06:20 +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-64923@lists.php.net to get a copy of this message | ||
Hi,
use:
preg_match('/\Wgood\W/',$var);
or
preg_match('/\bgood\b/',$var);
I don't know exactly.
----- Original Message -----
From: Brandon Orther <orther@webintellects.com>
To: PHP User Group <php-general@lists.php.net>
Sent: Wednesday, August 29, 2001 12:02 AM
Subject: [PHP] Check if a word is in my string.
> 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?
>