ID:               42415
 Comment by:       judas dot iscariote at gmail dot com
 Reported By:      romaneos at gmail dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Windows
 PHP Version:      5CVS-2007-08-24 (CVS)
 New Comment:

This is the expected behaviuor. the engine is just warning you that you
are writting bad code.


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

[2007-08-24 13:54:11] romaneos at gmail dot com

Description:
------------
Fatal error:  Key element cannot be a reference



Reproduce code:
---------------
foreach($list as &$key=>&$value) {
    $key = $key+1;
    $value = $value+1;
}

This code will generate error:

    Fatal error:  Key element cannot be a reference



Expected result:
----------------
$list = array(1 => 2, 5 => 6);
foreach($list as &$key=>&$value) {
    $key = $key+1;
    $value = $value+1;
}


Expected result:

$list == array (
                2 => 3,
                6 => 7
               )

Actual result:
--------------
Fatal error:  Key element cannot be a reference



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


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

Reply via email to