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:
$arr = array("z" => "z", "a" => "a", "b" => "b");
foreach($arr as $key => val)
print("$key: $val\n");
Outputs:
z: z
a: a
b: b
Whereas
$arr = array("a" => "a", "b" => "b", "z" => "z");
Outputs:
a: a
b: b
z: z
So my question is then: is this behavior defined at a specification level? Can I have reasonable certainty that this behavior will not be changed in future versions of PHP?