I also just ran into this issue. This is NOT intended behavior. the first loop changes the array, which is expected behavior, but the the issue is re-using the variable '$value' in the second loop and the fact that that variable itself doesn't lose scope after the first loop. The array itself is fine. if you use '$value2' in the second loop, everything displays just fine. I guess it boils down to why doesn't PHP automatically unset the $value variable after the first loop, since that is its scope? what possible reason would be needed to keep that variable set, and why wouldn't the second loop overwrite it?
I also just ran into this issue. This is NOT intended behavior. the first loop changes the array, which is expected behavior, but the the issue is re-using the variable '$value' in the second loop and the fact that that variable itself doesn't lose scope after the first loop. The array itself is fine. if you use '$value2' in the second loop, everything displays just fine. I guess it boils down to why doesn't PHP automatically unset the $value variable after the first loop, since that is its scope? what possible reason would be needed to keep that variable set, and why wouldn't the second loop overwrite it?