Re:How PHP's foreach works
by stormbrew on Thursday February 28, 2013 @03:08AM
(#5297661)
Most hash tables have a semi-random order dictated by the hash algorithm in combination with the bucket count. PHP Arrays are ordered by insertion order (each slot in the hash table has a next pointer, the last of which is appended to on insertion).
The order may be unusual or even non-obvious, but it is predictable.
The order may be unusual or even non-obvious, but it is predictable.