ID:               41169
 User updated by:  mobile-g at softhome dot net
 Reported By:      mobile-g at softhome dot net
 Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: Red Hat
 PHP Version:      4.4.6
 New Comment:

var $myArray = Array();

foreach($this -> mayArray['value'] as $value){
    $myVAR += $value; //changed this line
}


actually it isn't asssigning to itself...
this version is correct.


Previous Comments:
------------------------------------------------------------------------

[2007-04-23 04:36:57] mobile-g at softhome dot net

Description:
------------
running a foreach loop on an empty array causes the test key to be
created.

Note this code has been pulled from a class, I have kept this structure
in case that has relevance.

Reproduce code:
---------------
var $myArray = Array();

foreach($this -> mayArray['value'] as $value){

    $myArray += $value;
}

Expected result:
----------------
Ideally the loop wouldn't run, or would error when trying to locate a
none existant key.

Actual result:
--------------
myArray() has an empty key called "value" added to it.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41169&edit=1

Reply via email to