Re: [PHP] Problem iterating over an array with foreach and a reference variable

2007-07-25 Thread Robin Vickery
On 24/07/07, Chris Mika <[EMAIL PROTECTED]> wrote: I don't know if I'm doing something wrong or if this is a bug. Very simply: I created an array with values 1-5. I use a foreach loop to iterate over it to add 1 to the values. It correctly iterates over the array except for the last value. Code

Re: [PHP] Problem iterating over an array with foreach and a reference variable

2007-07-24 Thread Jochem Maas
Chris Mika wrote: > I don't know if I'm doing something wrong or if this is a bug. the problem is due ot reuse of the variable you define by reference in the second loop - cant really explain why its doing what you see but IIRC its not a bug, an artifact of the way references work. someone with a

[PHP] Problem iterating over an array with foreach and a reference variable

2007-07-24 Thread Chris Mika
I don't know if I'm doing something wrong or if this is a bug. Very simply: I created an array with values 1-5. I use a foreach loop to iterate over it to add 1 to the values. It correctly iterates over the array except for the last value. Code: "; foreach ($test as $part) { print "($part)