Re: foreach loop changed after 4.3 -> 4.4 upgrade

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I switched from 4.3 to 4.4 on a server with a huge web application using both foreach loops with and without the keys.. No problem whatsoever..

Evert

Larry Brown wrote:

I found that the only way to get the function to behave is to add the
key...

foreach($multiarray as $key=>$subArray)

Now it displays as it previously did where $subArray is concerned.  Is
there something I'm missing here?  Was I the only person not using
"keys"?

On Mon, 2005-08-22 at 21:28, Larry Brown wrote:
I had a foreach loop working on an array as such:

$multiarray = array(array('person','person'),array('another','another'))

the array was put through

foreach($multiarray as $subArray){

do something with array

}

on each loop I would see $subArray= array([0] = 'person',[1] = 'person')
and then $subArray= array([0] = 'another',[1] = 'another')

In other cases person might have some other value in the [1] position.
(it is being used in a function to create a select statement).

After the upgrade from 4.3 to 4.4 though each iteration gives...

array([0] = array([0] = 'person', [1] = 'person'),[1] = 0)  and
array([0] = array([0] = 'another', [1] = 'another'),[1] = 1)

I find it hard to believe that I must rewrite every foreach loop in my
application to adjust to this.  After all everything I've read states
that the 4.4 release was just a bug and security fix release.

Has anyone seen this behaviour?


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux