On 12-01-07 07:30 PM, Tim Behrendsen wrote:
When you use an ampersand on the variable, that creates a reference to
the array elements, allowing you to potentially change the array
elements themselves (which I'm not doing here).
http://www.php.net/manual/en/control-structures.foreach.php
I do notice in the manual that it says, "Reference of a $value and the
last array element remain even after the foreach loop. It is
recommended to destroy it by unset()." But that doesn't really explain
why it contaminates the next foreach loop in such an odd way. You
would think that the $row in the second loop would be assigned a
non-reference value.
Tim
Tim,
You are using the &$variable in an unintended (by PHP designers), and I
suggest undefined manner.
So the outcome cannot, but definition be explained.
Was this intended, and what were you trying to accomplish?
Stephen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php