"Manuel VáZquez Acosta" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Try:
>
> if (strpos($str2, $str1) !== false)
>     echo "$str1 is inside $str2";
> else
>     echo "could not find $str1 inside $str2";
>
> "Php Webmaster" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi all,
> >
> > I have a little problem that I hope you can help me with.
> >
> > I have the following strings:
> >
> > $str1 = "Bob";
> > $str2 = "My Name Is Bob";
> >
> > How can I get PHP to look for $str1 inside of $str2?
> >
> > Also, what about if "Bob" inside of $str2 is in different places?
> >
> > I would like something like:
> >
> > if ($str1 IS INSIDE OF $str2) {
> > echo "str1 is inside of str2";
> > }
> > else {
> > echo "could not find str1 inside of str2";
> > }
> >
> > Any ideas appreciated.

Thanks! Just what I needed.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to