Re: Proposal for a new array function
| From: | François Laupretre | Date: | Mon, 08 Feb 2016 15:44:06 +0000 |
| Subject: | Re: Proposal for a new array function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91117@lists.php.net to get a copy of this message | ||
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