77
When an array is passed to foreach is the output order guaranteed to be the same as the input? I know in some languages that the output order is not guaranteed since each element is processed at the same time.
For example, I'm passing a sorted array to foreach to write to a file. I want to be sure that the array will be sorted in the output file.