Re: Unusual Array Results

From: Date: Tue, 05 Oct 2004 22:43:08 +0000
Subject: Re: Unusual Array Results
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-36637@lists.php.net to get a copy of this message
On Tue, 5 Oct 2004 13:49:11 -0700, Wendell Frohwein <wendell@3rdpixel.com> wrote: > Hello all again, I am using php 5.0.1 with mysql 4.1.4a-gamma. After I > did this upgrade, I noticed pieced of my code were failing. Took me a > while to figure it out. When I would be working with arrays, sometimes I > would call the values out like so: > > $value=$thearray[0]; > > Every piece of script where I refer to the value like this has failed. > So I ran a print_r() function to see what the output is. This is what I > got: > > Array ( [] => 90606 [1] => 90610 [2] => 90660 [3] => 90661 [4] => 90662 > [5] => 90665 ) > > This is not a huge problem, I just have to use foreach() instead of > for() in my loop. Took me a good while to figure this out. > Could this be a glitch within php 5.0.1? If so, where could I report > this? > How are you populating your array? I just tried your code creating the array as such: $arr = array (90606, 90610, 90660, 90661, 90662); and I got the desired result, which is a 0 indexed array. I'm running PHP 5.0.1 as well, so I don't think this is a bug with the interpreter. Can you post your array initialization code?

« previous php.db (#36637) next »