Skip to content

Comment on What to Look For in PHP 5.4parent

Comments

But they're not arrays. JavaScript and Lua do the same thing, allowing you to assign numeric or hashed keys on objects (or tables in Lua), but they don't call them Arrays, because they aren't.

PHP's arrays combine both vectors and associative arrays, but both numerically indexed arrays and associative arrays are types of arrays, are they not?

Arrays have expected behavior and implementations. So do hash maps. It's fine to amalgamate them, just give it the right name.

Whether associative arrays use hash maps underneath is an implementation detail, not fundamental to the interface PHP provides to [associative] arrays.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.