Is this a bug in PHP?

<?php

$items = array('apple', 'banana', 'carrot');

print_r($items);

foreach ($items as &$item) { }

print_r($items);

foreach ($items as $item) { }

print_r($items);

// Output:

Array
(
     [0] => apple
     [1] => banana
     [2] => carrot
)
Array
(
     [0] => apple
     [1] => banana
     [2] => carrot
)
Array
(
     [0] => apple
     [1] => banana
     [2] => banana
)

Two bananas in the last set?! Not what I expected.

Richard



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to