Order of items of a table in a foreach


#1

if I iterate over a table with a foreach, is there a guaranteed order in which they come out? FIFO?


#2

No, this order is not guaranteed; it depends on the sequence of additions/removals as well as on the keys themselves. If you need a guaranteed iteration order, use an array.

Peter