Le 08/02/2016 15:32, Matthew Setter a écrit :
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)

The reason for it is to check if the array passed to it only had numeric
keys.

Interesting. If you want to check that your argument has numeric keys *only*, you should change the function's name.

For a better consistency, may I suggest a function that would allow to know whether array keys are all numeric, all strings, or mixed. Something like array_keys_type() returning one of 3 predefined constants : ARRAY_KEYS_NUMERIC, ARRAY_KEYS_STRING, ARRAY_KEYS_MIXED.

Regards

François


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to