Re: Proposal for a new array function

From: Date: Mon, 08 Feb 2016 17:49:32 +0000
Subject: Re: Proposal for a new array function
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-91128@lists.php.net to get a copy of this message
On 08/02/16 17:36, Markus Fischer wrote:
Hi, On 08.02.16 18:06, Cesar Rodas wrote:
return array_keys($arr) !== range(0, count($arr) - 1);
array_keys($array) === range(0, count($array)-1)
That approach would fall flat when the numeric keys are not consecutive: $array = [1=>"a", 3=>"b"]; Disclaimer: AFAIK complete goal of the function wasn't yet stated, thus this could be considered /acceptable/. cheers, - Markus I would read 'has_numeric_keys' as accepting any keys of type int or float.
Not sure if this was the intention, but would be my expectation from the method name. - Matt.

« previous php.internals (#91128) next »