Re: [RFC][Under Discussion] Add functions array_key_first() and array_key_last()

From: Date: Sun, 17 Jun 2018 20:16:24 +0000
Subject: Re: [RFC][Under Discussion] Add functions array_key_first() and array_key_last()
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-102283@lists.php.net to get a copy of this message
On 06/15/2018 08:37 AM, niel wrote:
On 13/06/18 20:26, Enno Woortmann wrote:
Hello internals, I've changed the status of the currently introduced RFC to add the functions array_key_first() and array_key_last() to "Under Discussion". https://wiki.php.net/rfc/array_key_first_last Regards, Enno
What is the behaviour if the array does not exist? From the current RFC it appears it would return null? Wouldn't it be better to return false for this situation?
I don't like throwing false when something doesn't exist. apcu does that - returns false instead of null when a record doesn't exist, and it is very problematic when the stored value literally is false. granted a boolean can't be used for an array key, but still, if there isn't something to return than null is better than a boolean. boolean is a value, null is the absence of a value, which is more accurate, no?

« previous php.internals (#102283) next »