4 ms·
Does PHP have a HashMap class now? I haven’t written PHP for a few years now but associative array used to be how they were referred to.
by duncan-donuts 4y ago
Does PHP have a HashMap class now? I haven’t written PHP for a few years now but associative array used to be how they were referred to.
- meling 4y agoYeah, I pretty sure Perl also called them associative arrays, but like you I haven’t written much Perl since Perl 4/5.
- darrenf 4y agoIn all my time as a Perl dev (since 1996) I don't think I've ever heard the term "associative array" except at the start of `perldoc perldata` - which says they're known as hashes and then never uses the term again. DESCRIPTION Variable names Perl has three built-in data types: scalars, arrays of scalars, and associative arrays of scalars, known as "hashes". A scalar is a single string (of any size, limited only by the available memory), number, or a reference to something (which will be discussed in perlref). Normal arrays are ordered lists of scalars indexed by number, starting with 0. Hashes are unordered collections of scalar values indexed by their associated string key. Hash is ubiquitous.
- draegtun 4y agoYes they used to be called Associative Arrays. I think the change occurred between Perl4 & Perl5. In Programming Perl it says "Associative Arrays" in 1st edition and "Hashes (Associative Arrays)" in 2nd edition. NB. 2nd edition was the first to cover Perl5
- kijin 4y agoIt doesn't, at least according to the current documentation. Not sure why they would need a class for that when they already have a primitive type that does the job. I guess maybe a new OO interface will have its parameters ordered more consistently?