Re: [PHP] needle in a haystack (Can't find :)

2002-12-16 Thread Ernest E Vogelsinger
Define the haystack _before_ you look into it, and you'll find it.

At 09:56 16.12.2002, Jason Wong said:
[snip]
>On Monday 16 December 2002 16:23, John Taylor-Johnston wrote:
>> http://www.php.net/manual/en/function.in-array.php
>>
>> Can't find the °ù¢# $needle in my $haystack. Why? :p
>>
>> (It is a serious example :)
>>
>> >
>> $needle = "Ten things I hate about you";
>>
>> if(in_array($needle, $haystack)) {
>> echo "Found it";
>> }else{
>> echo "Not there";
>> }
>>
>>
>> $haystack = array ("Ten Things I Hate About You",
>> "10 Things I Hate About You",
>> "Ten things I hate about you",
>> "10 things I hate about you",
>> "Ten Things That I Hate About You",
>> "10 Things That I Hate About You",
>> "Ten things that I hate about you",
>> "10 things that I hate about you",
>> "ten things I hate about you");
>
>How about defining $haystack *before* trying to use it?
>
>-- 
>Jason Wong -> Gremlins Associates -> www.gremlins.biz
>Open Source Software Systems Integrators
>* Web Design & Hosting * Internet & Intranet Applications Development *
>
>/*
>Fay: The British police force used to be run by men of integrity.
>Truscott: That is a mistake which has been rectified.
>   -- Joe Orton, "Loot"
>*/
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
[snip] 

-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] needle in a haystack (Can't find :)

2002-12-16 Thread Jason Wong
On Monday 16 December 2002 16:23, John Taylor-Johnston wrote:
> http://www.php.net/manual/en/function.in-array.php
>
> Can't find the °ù¢# $needle in my $haystack. Why? :p
>
> (It is a serious example :)
>
> 
> $needle = "Ten things I hate about you";
>
> if(in_array($needle, $haystack)) {
> echo "Found it";
> }else{
> echo "Not there";
> }
>
>
> $haystack = array ("Ten Things I Hate About You",
> "10 Things I Hate About You",
> "Ten things I hate about you",
> "10 things I hate about you",
> "Ten Things That I Hate About You",
> "10 Things That I Hate About You",
> "Ten things that I hate about you",
> "10 things that I hate about you",
> "ten things I hate about you");

How about defining $haystack *before* trying to use it?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Fay: The British police force used to be run by men of integrity.
Truscott: That is a mistake which has been rectified.
-- Joe Orton, "Loot"
*/


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




[PHP] needle in a haystack (Can't find :)

2002-12-16 Thread John Taylor-Johnston
http://www.php.net/manual/en/function.in-array.php

Can't find the °ù¢# $needle in my $haystack. Why? :p

(It is a serious example :)

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php