ID:               47583
 Updated by:       [email protected]
 Reported By:      lgynove at 163 dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: windows xp
 PHP Version:      5.2.9
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

At the end of the first loop $v is the last element in the array, you
then re-assign it in the next loop each time.

add unset($v); between the loops to see the difference.


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

[2009-03-06 02:43:23] lgynove at 163 dot com

Description:
------------
think this...is bug or not

Reproduce code:
---------------
$a = array(1,2,3);
$b = array(3,2,1);
foreach($a as $k => &$v);
foreach($b as $k => $v);
print_r($a);
print_r($b);

Expected result:
----------------
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)
Array
(
    [0] => 3
    [1] => 2
    [2] => 1
)


Actual result:
--------------
Array
(
    [0] => 1
    [1] => 2
    [2] => 1
)
Array
(
    [0] => 3
    [1] => 2
    [2] => 1
)



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


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

Reply via email to