in reply to changing array size in foreach loop: is it safe?

Yeah that's a definite "don't do that". You should either make a duplicate of the array, or in the case that you're just appending you could iterate over indices instead of the array itself.

  • Comment on Re: changing array size in foreach loop: is it safe?