Thanks, this is what I ended up doing, copying the reference to a temporary array. This is still really confusing...I would expect since I was using a my variable it would never alter the array. I would at least expect there to be a warning message printed in this case, but no warning is generated.
I wonder if it's more expensive to have to create a temporary array rather than have foreach return real scalars for each value. Hmm...