When I perform a foreach loop over an associatve array in php, the order in which it is performed is the order in which it is defined.
For example:
$
Your questions seems like you came from programming in Perl where "arrays" are not guaranteed to be in the order you created them. But in PHP it has always been ordered and will always be, otherwise a lot of code will break.