ID: 47388
User updated by: martin at itmission dot com
Reported By: martin at itmission dot com
Status: Open
-Bug Type: Feature/Change Request
+Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.3.0beta1
New Comment:
Changed category
Previous Comments:
------------------------------------------------------------------------
[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