4 ms·
Sorry to go down that road, but the reason people rag on PHP's associative arrays, is that its the only array that PHP has. A hashmap with mixed keys is hardly
by JonnieCache 16y ago
Sorry to go down that road, but the reason people rag on PHP's associative arrays, is that its the only array that PHP has.
A hashmap with mixed keys is hardly the most practical choice for an all purpose primitive data structure.
Python already has proper arrays where you might have some chance of fast sequential access. The ordered dict or whatever is just another tool in the box.
Basically, PHP makes you do shit like this: http://www.php.net/manual/en/function.is-array.php#102652 http://www.php.net/manual/en/function.is-array.php#102652
- chalst 16y agoThe same people don't seem to bash Lua's tables.
- bxr 16y agoThey've probably never _used_ Lua's tables.
- JonnieCache 16y agoHmmmm. I feel I may be proving the OPs entire point rather too well with this line of enquiry. I don't think I've ever trolled myself before. How embarrassing. This kind of thing is trickier in places like HN though, because a statement is only showing off to people who already have the knowledge. There are millions(?) of people reading here, so statistically most of them probably wont know some obscure piece of knowledge about the problems of the key hashing function under random access in numerical PHP arrays. It may be showing off to the couple of people actively engaged in the debate, but to everyone else its educational. That's most of the reason I come here, to be honest. Crumbs of insight casually discarded during the debates of much cleverer people.
- sjs 16y agoFine, s/Python/JavaScript/ then. Nobody applauds JS for it but neither is it derided as PHP is for this reason.