Re: [PHP-DEV] Re: Proposal for a new array function

2016-02-11 Thread Rowan Collins
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

[PHP-DEV] Re: Proposal for a new array function

2016-02-11 Thread Christian Wenz
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

[PHP-DEV] Re: Proposal for a new array function

2016-02-09 Thread Simon Svensson
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

[PHP-DEV] Re: Proposal for a new array function

2016-02-08 Thread marcelo everson Ramos
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