Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102283 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77811 invoked from network); 17 Jun 2018 20:16:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jun 2018 20:16:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=alice@librelamp.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=alice@librelamp.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain librelamp.com designates 45.79.96.192 as permitted sender) X-PHP-List-Original-Sender: alice@librelamp.com X-Host-Fingerprint: 45.79.96.192 librelamp.com Received: from [45.79.96.192] ([45.79.96.192:34186] helo=librelamp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/3E-29356-D91C62B5 for ; Sun, 17 Jun 2018 16:16:29 -0400 Received: from localhost.localdomain (unknown [IPv6:2600:1010:b008:b4ae:4e8c:ad97:defa:6ce6]) by librelamp.com (Postfix) with ESMTPSA id CACCE1188 for ; Sun, 17 Jun 2018 20:16:25 +0000 (UTC) To: internals@lists.php.net References: <75db877c-ef0b-7d3b-48a8-9879d90352b0@web.de> <7052a9c2-7c19-a382-8967-8fda648569df@blueyonder.co.uk> Message-ID: Date: Sun, 17 Jun 2018 13:16:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <7052a9c2-7c19-a382-8967-8fda648569df@blueyonder.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first() and array_key_last() From: alice@librelamp.com (Alice Wonder) 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?