Re: Add is_vectorlike($array) function
| From: | Rowan Collins | Date: | Thu, 04 May 2017 22:00:07 +0000 |
| Subject: | Re: Add is_vectorlike($array) function | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98967@lists.php.net to get a copy of this message | ||
On 04/05/2017 13:51, Michael Morris wrote:
For what it's worth, the Drupal assertion inspector calls these "Strict Arrays" since that's what they are - arrays in the true sense of the term found in all other languages. What PHP is calling an "array" is more accurately a "map" or "hash"I'm not sure on that terminology. Many languages / environments have "sparse" arrays, arrays with negative indexes, and other variants. It's true that PHP's "array" type goes well beyond those, but we're talking about more than "non-associative" here (or I hope we are). I think possibly the best term would be "list" - a collection where order is preserved, but there is no separate notion of keys: on a "list-like array", $foo[42] can be seen as "access the 43rd value", not "access the value with key 42". Regards, -- Rowan Collins [IMSoP]