The problem in terms here is that PHP blurs the lines between hashes,
arrays, whatever you want to call them. There is just one construct,
which they call an Array. Each item in the array can have both a hash
key (a string) and an index (an integer). if you write “myarray[‘test’]
= item”, an index automatically gets created in addition to the hash
Additionally, PHP arrays have an order, which is not necessarily the
same as the order given by the indices. In fact, it is very often
different. Usually it is the order in which items were added to the
array. Calling “each()” iterates over the array in the hidden order. If
you want, you can sort the array/hash by the internal/hidden ordering,
and indices and hashes are unchanged, but iterating over it with
"each()" is different.
Of course, this sounds confusing all thrown together like this, but it
really isn’t that bad. You can do some nifty tricks, all because of the
strange hybrid php hash/lists.
On Mar 2, 2004, at 11:33 PM, Lothar Scholz wrote:
Wednesday, March 3, 2004, 6:33:01 AM, you wrote:
Simplest solution: use an ordered hash implementation, such as
Please don’t use this term “ordered hash” anymore. It is just stupid
wrong. You may refer to a “hash” or a “tree” (balanced or not). If
someone asking about an ordered hash just point out that he is
expecting something that does not exist in the known universe.