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?


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to