RE: [PHP] Searching in a string
| From: | borko.net) | Date: | Sun, 10 Sep 2000 07:06:09 +0000 |
| Subject: | RE: [PHP] Searching in a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16041@lists.php.net to get a copy of this message | ||
try
$stringtosearch = "Hi, this is my world and I like it well!";
eregi("^.*(world)+.*$", $stringtosearch, $regs)
$regs[1] should - if it was present - contain "world"
I think this should work fine.
cheers, Arne
> -----Original Message-----
> From: Jeff Lacy [mailto:jeffdl@mn.mediaone.net]
> Sent: Sunday, September 10, 2000 8:21 AM
> To: php-general@lists.php.net
> Subject: [PHP] Searching in a string
>
>
> Hello. I have a string, let's say $string and that has several things in
> it. So, $string=hello,there,world;. I would like to know if I can do a
> simple if statement to see if world is in $string. world might not always
> be in $string, so I need to make sure. How can I do this? Thank you in
> advance.
>
> PLEASE EMAIL ME A REPLY. MS Outlook Express will DIE after I visit the
> php.general news group. It will just freeze. I can look at the
> posts, but
> I can't look at anything else without rebooting.
>
>
>
> --
> 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
>