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]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php