Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102280 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82308 invoked from network); 15 Jun 2018 17:58:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2018 17:58:53 -0000 Authentication-Results: pb1.pair.com header.from=enno.woortmann@web.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=enno.woortmann@web.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain web.de designates 212.227.17.12 as permitted sender) X-PHP-List-Original-Sender: enno.woortmann@web.de X-Host-Fingerprint: 212.227.17.12 mout.web.de Received: from [212.227.17.12] ([212.227.17.12:47549] helo=mout.web.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/C5-29356-75EF32B5 for ; Fri, 15 Jun 2018 13:58:53 -0400 Received: from [192.168.0.48] ([77.21.86.66]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MT8bi-1fd7rA2lRm-00S7qX; Fri, 15 Jun 2018 19:58:42 +0200 To: niel , internals@lists.php.net References: <75db877c-ef0b-7d3b-48a8-9879d90352b0@web.de> <7052a9c2-7c19-a382-8967-8fda648569df@blueyonder.co.uk> Message-ID: <02781c8b-f7aa-bea2-c04c-da95120465c9@web.de> Date: Fri, 15 Jun 2018 19:58:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.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: quoted-printable X-Antivirus: Avast (VPS 180615-2, 15.06.2018), Outbound message X-Antivirus-Status: Clean X-Provags-ID: V03:K1:geQkQYBA5ja2NUXPaD9XZmBo7xyNsHgjMZ1/39eV858MfWYCkpf qh6lTG3k4RyTzy7k++1JeolqrDkF8yC/eM6Jm9Xa1um9lPujovdFU1q9EYHNkkE55NHb/i8 e4qKJm3frtc7hUqHdFBrC+73t/bwK119Dlsp22DiXSCgrgqyZffWOjlVAcvq2H+pBYhna9r MYgHjTbELGgqofdIv3BOg== X-UI-Out-Filterresults: notjunk:1;V01:K0:4qLu4sehYDw=:TnP4ia8K4vH3SeP4eL3Oiz nRB6mIVSPs+d+zj5gxxbIRK0G4chR2SlH26hNszkxFjmOeR0Zm1uk+UAKEZzstBxXvjIxZXRG yGWvOvU+mB81Shzs8nEag+oP44hX80h7XbX1UaLO+W1AMcXrDQskyP7WVmP4N7auwZ1aE35ek A/G9Ooq7TC0FNMsPzE7TxP4nFAGiuxS+4qWQl4Cruvtdb//EebWvDfpLnnjTRh43YWreLK9Pm kFI/zPO4VPnBiPkhe+RXAgwhHX/WTc8QHXXoUfOO0L2RUHjcGvzOhdM04jrYz1C+YJiVa6Qmy wI/opzfSvDH/WvIo1tciJJUmqLBO7PC9afmfOjLC4v1ELOzY7jcrG7bwEhqALb4YQ92D6IDI8 Sfh5XekvyfCER9IfJZa/Wn/gTVwfK8hH/r4VHbto1jzSJL4gmJvhmayIhYDAy0CBHaXLuw322 /SgRjIMX3pw7NVtl2fqOZfhkNB+5Cup1DbnJxyj9hqGBjLDkmExORDE9S0qe54FB/2W5M22XB 2tEGKJg3+2zm9x8XHgAq4bW/EEtHq6NJaIMWddvBqrFbQzE9NIq+o4B9lFZ7lfL3FqnqCSi/1 IG3SIPca6PQiqnd6BKm5ZP+r8sAu989dkO6p+YXL2PXV2MrtTA3hDN2+Fuz9KP3ciZ2M60BJf cwHowzGPfh9mOHxltvDbQuZgDfmu0oKjxoS6dCWQF0Angu+viV+hXOi4po1bnrzDu4D8CKGDo xYqT/tJQuoo7JwTLz0rmGQm393wEQLSwFX2BiiwRhsOdM4kKbU3/nDXoBmj2VvesK9zUocs4x BMneoNl Subject: Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first() and array_key_last() From: enno.woortmann@web.de (Enno Woortmann) Hi niel, On 15.06.2018 at 17:37 niel wrote: > What is the behaviour if the array does not exist? From the current=20 > RFC it appears it would return null? Wouldn't it be better to return=20 > false for this situation? > Thanks for the comment. Why do you think false would be a better return=20 value? Currently if the given value isn't an array or no parameter is given a=20 warning will be thrown and null will be returned. In my opinion null exists to show the absence of a defined value. If one = of the proposed functions is called with a variable which isn't an array = or an empty array (or even a call with no parameter) there is neither a=20 first nor a last key and thus null is the value which is returned. Compare the tests for the error cases: https://github.com/php/php-src/pull/3256/files#diff-e00a584724b997f38e851= e15f1e20c39 This behavior is also implemented in existing functions like eg.=20 array_pop(): https://github.com/php/php-src/blob/master/ext/standard/tests/array/array= _pop_errors.phpt Enno