Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102751 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17485 invoked from network); 11 Jul 2018 13:38:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2018 13:38:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=levim@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.208.177 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.208.177 mail-lj1-f177.google.com Received: from [209.85.208.177] ([209.85.208.177:42344] helo=mail-lj1-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/35-15421-348064B5 for ; Wed, 11 Jul 2018 09:38:11 -0400 Received: by mail-lj1-f177.google.com with SMTP id 1-v6so19383514ljv.9 for ; Wed, 11 Jul 2018 06:38:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=0Mc1RcEzzTlWRLsSS4K/IctQwdwD9P6vIRt7FbAkCO4=; b=EMi4v76S1OUIoZD3S3acPZUzpXX6FJgXEI1e7WqXmfM/cERbDtynjadVIicUQDMcFJ ++YY41sUQhMZA2X6mv4lxVRXGA5nLBWYhKtEdwyC9rQgr2nwEXLUsgojc6bstJ9Tjo3T jT58y04FIyUnf6PwbRo15GE3sD7x3PINAgWD7pNpvTZVm2Vk/jdhvYotWz6msw+oinc4 IhqR1jFuvZk2HWy4OlX5ceAF15tA7za1ndIQNv4n3QKXAnqRbJmA4WxuOBgzQRHJe+o1 TVxh57c85EGdhMct5r6Ikb104RWMU/3w60QlQw2fSn6Zm+WSquU16NPuM3vmdiDnCg6X Wj2w== X-Gm-Message-State: APt69E2yRsYZ/kWN4Vj2zRFi472xQa7eDwvz4asZX+9IackUq6BCE0km hvFvHynFYecgwBw13cPams73K9CwFpzj6LCXdy0= X-Google-Smtp-Source: AAOMgpevhOdWsi57HhcbhE7PyxWwRHG32FY2zEC70VHUqGrQuIYP3ccsolINjS1vDZg23BRYjmODgG2Lu1mNaTpqVY4= X-Received: by 2002:a2e:9941:: with SMTP id r1-v6mr19168912ljj.53.1531316288277; Wed, 11 Jul 2018 06:38:08 -0700 (PDT) MIME-Version: 1.0 References: <15027216.5udLFCpNTc@mcmic-probook> In-Reply-To: <15027216.5udLFCpNTc@mcmic-probook> Date: Wed, 11 Jul 2018 07:37:56 -0600 Message-ID: To: come@opensides.be Cc: internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re:[PHP-DEV] [VOTE] array_key_first(), array_key_last(), array_value_first(),array_value_last() From: levim@php.net (Levi Morrison) > Either I know that the array is not empty, or I do not care because NULL = will 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 a= dd more code to handle this special case while I do not need any with array= _first_value. This is true. For completeness the fix is very mild: if (([$_, $value] =3D array_first(some_function()) && $value > 3) { // do something } I still think this is better. Forcing you to handle the error case is not a bad thing.