title: Is foreach guaranteed to iterate in the array order in php?
body: <p>When an array is passed to <code>foreach</code> 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.</p>
  
  <p>For example, I'm passing a sorted array to <code>foreach</code> to write to a file. I want to be sure that the array will be sorted in the output file.</p>