ID:               47388
 Comment by:       martin at itmission dot com
 Reported By:      martin at itmission dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP
 PHP Version:      5.3.0beta1
 New Comment:

Also happens in 5.2.8


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

[2009-02-16 18:56:12] martin at itmission dot com

Changed category

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

[2009-02-14 19:47:28] martin at itmission dot com

Description:
------------
When using foreach on an array using the reference syntax, stuff breaks
later.

Reproduce code:
---------------
<?php

$a = array(0, 1, 2, 3, 4);

foreach($a as $k => &$v)
{
        $v++;
}

foreach($a as $k => $v)
{
        echo("$k => $v\n");
}

?>

Expected result:
----------------
0 => 1
1 => 2
2 => 3
3 => 4
4 => 5

Actual result:
--------------
0 => 1
1 => 2
2 => 3
3 => 4
4 => 4


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


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

Reply via email to