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.
foreach
doc. It doesn't explicity state that order will remain. I'm not talking about examples neither comments. The only reference is toreset()
talking about the current element and the next element.