Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77276 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32107 invoked from network); 16 Sep 2014 20:46:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2014 20:46:49 -0000 Authentication-Results: pb1.pair.com header.from=robin@kingsquare.nl; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=robin@kingsquare.nl; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain kingsquare.nl designates 141.138.142.202 as permitted sender) X-PHP-List-Original-Sender: robin@kingsquare.nl X-Host-Fingerprint: 141.138.142.202 spring.kingsquare.nl Linux 2.6 Received: from [141.138.142.202] ([141.138.142.202:33038] helo=spring.kingsquare.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/2B-64534-6B1A8145 for ; Tue, 16 Sep 2014 16:46:48 -0400 X-No-Relay: not in my network Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by spring.kingsquare.nl (Postfix) with ESMTPSA id 74CC6E9D1B6 for ; Tue, 16 Sep 2014 22:46:42 +0200 (CEST) Received: by mail-lb0-f170.google.com with SMTP id c11so597581lbj.1 for ; Tue, 16 Sep 2014 13:46:42 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr19374186lal.71.1410900402309; Tue, 16 Sep 2014 13:46:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.134.67 with HTTP; Tue, 16 Sep 2014 13:46:21 -0700 (PDT) In-Reply-To: <541896CF.50000@gmx.de> References: <540D638B.8010303@php.net> <24B60FB5-35B8-4B6F-AD6C-54A8B24D4462@ajf.me> <540DC38B.3070700@gmx.de> <324F7C72-BC72-4109-941E-BA2947EFA4E7@ajf.me> <0D0523A9-088B-4923-BA21-22F560E18013@ajf.me> <541896CF.50000@gmx.de> Date: Tue, 16 Sep 2014 22:46:21 +0200 Message-ID: To: Christoph Becker Cc: Andrea Faulds , Adam Harvey , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: robin@kingsquare.nl ("Kingsquare.nl - Robin Speekenbrink") 2014-09-16 22:00 GMT+02:00 Christoph Becker : > Andrea Faulds wrote: > >> On 16 Sep 2014, at 19:38, Adam Harvey wrote: >> >>> On 16 September 2014 11:34, Andrea Faulds wrote: >>>> By popular demand, I=E2=80=99ve changed the RFC to instead propose a ?= ? operator, after Nikita Popov generously donated a working ?? patch. In do= ing so, the RFC is renamed =E2=80=9CNull Coalesce Operator=E2=80=9D. >>>> >>>> Please read it: https://wiki.php.net/rfc/isset_ternary >>> >>> Love it! Kudos to you and Nikita. > > +1 > >>> Is it possible to chain ?? operators; ie $value =3D $foo ?? $bar ?? 'de= fault=E2=80=99? >> >> Yep: >> >> $ sapi/cli/php -r '$x =3D NULL; $y =3D NULL; $z =3D 3; var_dump($x ?? $y= ?? $z);' >> int(3) >> >> $ sapi/cli/php -r '$x =3D ["yarr" =3D> "meaningful_value"]; var_dump($x[= "aharr"] ?? $x["waharr"] ?? $x["yarr"]);' >> string(16) "meaningful_value" > Hi, As a userland point of view on this: will this have a shorthand? i.e. what will happen if i leave out the second part? ie. $var =3D $_GET['test'] ?? ; would that be the same as $var =3D @$_GET['test']; The RFC isnt clear in this regard (or that the righthand side of the operator _is_ required... maybe it's me ? Regards Robin Speekenbrink