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.
In reply to Re: changing array size in foreach loop: is it safe?
by Fletch
in thread changing array size in foreach loop: is it safe?
by Errto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |