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 #169882 is a reply to message #169869] Wed, 29 September 2010 10:23 Go to previous message
Geoff Berrow is currently offline  Geoff Berrow
Messages: 16
Registered: September 2010
Karma:
Junior Member
On Tue, 28 Sep 2010 18:24:58 -0700 (PDT), heartmeat
<brendon(at)actrix(dot)co(dot)nz> wrote:

> I must be missing something obvious, but, given:
>
> var $haystack = array(0);
> var $needle = '0_50';

var is not used in PHP. Some confusion with JavaScript?

Are you perhaps expecting array(0) to give you and empty array? It
doesn't, it gives you an array with one element.

An empty array would be:
$haystack = array();

>
> why does:
>
> in_array($needle,$haystack) return true?

See other answers.
--
Geoff Berrow (Put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs www.4theweb.co.uk/rfdmaker
[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 08:37:15 GMT 2024

Total time taken to generate the page: 0.04140 seconds