|
|
Kevin Wampler wrote:
> I don't know PHP, so I'm curious if you could elaborate a bit, since I'm
> used to viewing "dictionary" as more of less a synonym for "hashtable"
> in this context.
Hmmm... A dictionary in PHP is more like an array of key/value pairs. So
they preserve the order in which you inserted elements, they have integer
indecies, but they also act as hash tables. Plus, you can say things like
x[] = 27
to append 27 to the end of the array, whatever size it is. So they work as
both dictionaries, arrays, and ordered maps.
http://us3.php.net/manual/en/language.types.array.php
Honestly, I don't think I've ever *used* the fact that the keys maintain an
order even when they're not integers.
Lua dictionaries (called "tables") are also kind of odd, in that they are
apparently hashtables with special rules for entries with integer keys as
well as an independent "size", but I didn't follow it far enough to
understand what was going on exactly there. It was kind of funky mixing
integer and non-integer indecies, in the tutorials I was reading.
--
Darren New, San Diego CA, USA (PST)
There's no CD like OCD, there's no CD I knoooow!
Post a reply to this message
|
|