Re: Array - Match
| From: | Jed Verity | Date: | Sat, 07 Sep 2002 17:00:40 +0000 |
| Subject: | Re: Array - Match | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115613@lists.php.net to get a copy of this message | ||
Hello Chandu,
You can use in_array(needle, haystack) for this. For example,
if (in_array("abc",$subs)) {item found, do stuff...}
HTH!
Jed
On the threshold of genius, N. Pari Purna Chand wrote:
>
> I have $sub = "abc";
>
> and
>
> $subs[0] = "cde";
> $subs[0] = "iyu";
> $subs[0] = "abc";
> ..
> ..
> ..
> $subs[50] = "xyx";
>
> How to find whether $sub matches with any one of $subs[$i]
> I have used a for loop but it is
> returning true when $subs[$i] = "xxxxxabc".
>
> /Chandu
>
>
> -----------------------------------------------
> Powered by MihiraMail, Fast secure & reliable
> Brought to you by Mihira Net Pvt Ltd.
>