FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » why does in_array return true
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: why does in_array return true [message #169871 is a reply to message #169869] Wed, 29 September 2010 01:56 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 29/09/10 02:24, heartmeat wrote:
> hello all
>
> I must be missing something obvious, but, given:
>
> var $haystack = array(0);
> var $needle = '0_50';
>
> why does:
>
> in_array($needle,$haystack) return true?

You didn't specify strict checking, so the string equates to 0.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP manual note
Next Topic: Out Of Memory with Memory_limit à -1
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 04:17:11 GMT 2024

Total time taken to generate the page: 0.08370 seconds