Re: "Search" code finds ANYTHING
| From: | Raphael Pirker | Date: | Thu, 16 Aug 2001 02:28:39 +0000 |
| Subject: | Re: "Search" code finds ANYTHING | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62939@lists.php.net to get a copy of this message | ||
Hi Hugh,
> First, array_search returns an array of keys where the values are
> exact matches... while you want to match a substring (I think);
Yes, but exact matches are better :))
> Then, it searches through the array again using regular expressions,
> and each time it finds something, it over-writes all previous values...
> and if there were any matches to begin with, it WILL find them again.
Problem is not the overwriting part.. problem is it doesn't really "search",
it "finds" something instantly, whether it's inside the string or not
> And why is the search-string passed as a global while the
> array is passed by value?! This makes no sense to me.
I'm searching a number of arrays (3 to be exact) for only one search
string... $array is different all the time while $search_tmp is the same
But thanks a lot for the scripts, I will be trying them out immediately!
Regards,
Raphael