Probably because you're deleting entrys in an array currently used for the loop, thus messing it up. You should never manipulate the same array as the loop uses, use a copy of it and update the original after the loop
PHP Code:
temp.array = { "foo", "bar", "baz" };
for (temp.entry: temp.array) {
echo(temp.entry);
if (temp.entry == "foo") temp.array.delete(temp.var);
temp.var ++;
}
Echoes "foo" and "baz" since by deleting an entry, you shorten the array, thus skipping "bar".
Instead, do something like:
PHP Code:
temp.array = { "foo", "bar", "baz" };
temp.loopArray = temp.array;
for (temp.entry: temp.array) {
echo(temp.entry);
if (temp.entry == "foo") temp.loopArray.delete(temp.var);
temp.var ++;
}
temp.array = temp.loopArray;
