Christian Wenz wrote on 11/02/2016 09:17:
On Mon, Feb 8, 2016 at 09:32 AM, Matthew Setter wrote:
The approach I took was this:
return array_keys($arr) !== range(0, count($arr) - 1);
FWIW, this might not work for arrays with missing indices like [0 =>
'a', 2 => 'b']
I personally would appr
On Mon, Feb 8, 2016 at 09:32 AM, Matthew Setter wrote:
The approach I took was this:
return array_keys($arr) !== range(0, count($arr) - 1);
FWIW, this might not work for arrays with missing indices like [0 =>
'a', 2 => 'b']
I personally would appreciate a function like you proposed.
--Chr
On 08/02/16 15:32, Matthew Setter wrote:
> 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 ha
On the proposal for a new function to array that could be called
has_numeric_keys I believe would be the most appropriate as the name of the
function as well as its functionality. I believe that the creation of a
typo checking function would be more interesting. In other languages array
contains on