Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102746 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98761 invoked from network); 11 Jul 2018 08:18:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2018 08:18:18 -0000 Authentication-Results: pb1.pair.com header.from=come@opensides.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=come@opensides.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain opensides.be designates 195.154.20.141 as permitted sender) X-PHP-List-Original-Sender: come@opensides.be X-Host-Fingerprint: 195.154.20.141 lists.fusiondirectory.org Received: from [195.154.20.141] ([195.154.20.141:40486] helo=smtp.opensides.be) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/A2-15421-94DB54B5 for ; Wed, 11 Jul 2018 04:18:18 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.opensides.be (Postfix) with ESMTP id 63325BC110 for ; Wed, 11 Jul 2018 10:18:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at opensides.be Received: from smtp.opensides.be ([127.0.0.1]) by localhost (smtp.opensides.be [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jOdurS6fkJV5 for ; Wed, 11 Jul 2018 10:18:11 +0200 (CEST) Received: from mcmic-probook.localnet (63.120.199.77.rev.sfr.net [77.199.120.63]) by smtp.opensides.be (Postfix) with ESMTPSA id E283ABC107 for ; Wed, 11 Jul 2018 10:18:10 +0200 (CEST) To: internals@lists.php.net Date: Wed, 11 Jul 2018 10:18:10 +0200 Message-ID: <15027216.5udLFCpNTc@mcmic-probook> Organization: OpenSides User-Agent: KMail/5.2.3 (Linux/4.9.0-6-amd64; KDE/5.28.0; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart1550404.cCbCzjzHmn" Content-Transfer-Encoding: 7Bit Subject: Re: [PHP-DEV] Re:[PHP-DEV] [VOTE] array_key_first(), array_key_last(), array_value_first(),array_value_last() From: come@opensides.be (=?ISO-8859-1?Q?C=F4me?= Chilliet) --nextPart1550404.cCbCzjzHmn Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Le mardi 10 juillet 2018, 18:41:17 CEST Levi Morrison a =C3=A9crit : > People who argue against the tuple because they don't like the design > need to consider the bigger picture.=20 My guess is people arguing for the tuple do not understand the usecase :-) Each time I felt the need for array_first_value was because I was using it = on a function return to do something with it. Like: if (array_first_value(some_function()) > 3) { // do something } Either I know that the array is not empty, or I do not care because NULL wi= ll be ignored correctly. In the second case, with a tuple I=E2=80=99m stuck because if I do: if (array_first(some_function())[1] > 3) { // do something } If array_first returns NULL this will trigger a PHP error. So I have to add= more code to handle this special case while I do not need any with array_f= irst_value. C=C3=B4me --nextPart1550404.cCbCzjzHmn--