Re: checking to see if part of a variable exists?
| From: | James Holloway | Date: | Mon, 21 May 2001 10:53:56 +0000 |
| Subject: | Re: checking to see if part of a variable exists? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53691@lists.php.net to get a copy of this message | ||
Hi Sandeep,
<?
if (preg_match(/"@monkeys.com/i", $variable)) {
echo "Got some monkeys.";
} else {
echo "No monkeys here.";
}
?>
preg_match();
ereg();
eregi();
Will all help you.
James.
"Sandeep Hundal" <Sunny@mviva.net> wrote in message
news:A0A5617A0A05D5118EBD00508B8B953B5EA932@PROF-X...
> hi all!
>
> i need to see if a $variable has a piece of text included in it. how do i
do
> that?
>
> i need to do something like:
>
> if ($variable =matches= "@monkeys.com") { then do this}
>
> tia!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>