Re: Proposal for a new array function
| From: | Rowan Collins | Date: | Mon, 08 Feb 2016 15:24:10 +0000 |
| Subject: | Re: Proposal for a new array function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91115@lists.php.net to get a copy of this message | ||
Matthew Setter wrote on 08/02/2016 14:32:
I want to propose a new PHP array method, called has_numeric_keys (or something similar/better), that would have the following method signature: bool has_numeric_keys(array $array)I like it. I also suspect it could be implemented very efficiently in core, at least for certain special cases, which is a good reason not to just leave it in userland. For instance, as I understand it, some arrays in ZE3 (PHP7) are "packed" if they consist of (mostly?) sequential integers; any such array could instantly return true for this function. While on the other side, a polyfill with identical semantics but worse behaviour would be easy to provide as a composer package, reducing BC concerns. It would need an RFC, but that shouldn't be too hard to get drafted in this case. https://wiki.php.net/rfc/howto Regards, -- Rowan Collins [IMSoP]