Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89345 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9205 invoked from network); 23 Nov 2015 19:52:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2015 19:52:34 -0000 Authentication-Results: pb1.pair.com header.from=shadda@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=shadda@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.44 as permitted sender) X-PHP-List-Original-Sender: shadda@gmail.com X-Host-Fingerprint: 209.85.220.44 mail-pa0-f44.google.com Received: from [209.85.220.44] ([209.85.220.44:35662] helo=mail-pa0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/89-47837-28E63565 for ; Mon, 23 Nov 2015 14:52:34 -0500 Received: by pacej9 with SMTP id ej9so200642395pac.2 for ; Mon, 23 Nov 2015 11:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=hd2djfKJNbk/AAwMcNY4Fm3UXf3OUpas7XpOK2+r85s=; b=u9gwtknK+F5CGWcQnYU2bkET1ccDdOeN+QoqgcyNxLXhugdpkQXIT0aCyC+1B3SQBw miZutS6YN9Wnq0oSj1nwv0HBctsaZY4ylQKMN0oE84i7A4SIa144Wseq1yb+qUDzQm8f qoUNNEd0sn6zluS67WUClDqXvhztGWDBZh3z8XZ8igyInZMrb0f8gpqmJH+ckEBpk4IT SAe6jWMOGPp44436hV7Lk/zRZhl833/nLcMX9qg6R5ndWqdY0RLPnn+xXYTO/p54K0th ygC7zzO5+f775Km9Q9bjiXyoYXswDOYeoTPsAh7GmYM8qur6yGYgnGbHsvNwy76NwGRH gCSA== X-Received: by 10.68.241.41 with SMTP id wf9mr37964430pbc.145.1448308351397; Mon, 23 Nov 2015 11:52:31 -0800 (PST) Received: from [192.168.0.18] (70-36-238-3.dsl.static.fusionbroadband.com. [70.36.238.3]) by smtp.gmail.com with ESMTPSA id ck9sm11487071pad.28.2015.11.23.11.52.30 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 11:52:30 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) In-Reply-To: Date: Mon, 23 Nov 2015 11:52:29 -0800 Content-Transfer-Encoding: quoted-printable Message-ID: <457D19DF-746D-40D0-BA0F-7064D265901E@gmail.com> References: <4D5D4A6D-1E94-4893-B1DF-7A8C616C871A@gmail.com> <20.F5.23339.A9822565@pb1.pair.com> To: PHP internals X-Mailer: Apple Mail (2.3094) Subject: Re: [PHP-DEV] PHP7 Coalesce operator From: shadda@gmail.com (shadda) Er, that should read, =E2=80=9Canything non (null, false, undefined) is = true=E2=80=9D=20 > On Nov 23, 2015, at 11:51 AM, shadda wrote: >=20 > Hey, thanks for responding. >=20 > However, I still think that misses the point, or at least the true = utility of what I=E2=80=99m proposing. >=20 > In practice, you can ignore E_NOTICE and php will happily treat null = and !isset() as the same thing in *most* cases, so that=E2=80=99s not a = good indicator of truthiness.=20 >=20 > Basically in ECMA, anything non-null, false, or undefined is true. PHP = is very similar in that regard, but our reliance on E_NOTICE to (ahem) = enforce isset() checks is why, I assume, we=E2=80=99re introducing the = ?? operator to begin with.=20 >=20 > I just think it=E2=80=99d be nice to have a small variation on this = feature that was less concerned with a (defined|null) semantic and more = in keeping with PHP=E2=80=99s overall handling of implicit type = conversion in expressions.=20 >=20 > Does that make more sense? >=20 >> On Nov 22, 2015, at 12:41 PM, Andrea Faulds wrote: >>=20 >> Hi, >>=20 >> shadda wrote: >>> I had a question-suggestion based around the cool new operator = we=E2=80=99re getting in PHP7, the ?? operator, which as I understand it = is the functional equivalent to perl=E2=80=99s // operator; in that they = both test for whether or not a variable is defined, rather than it=E2=80=99= s truthiness. >>=20 >> This is not strictly correct. Though something of a misnomer, the = 'null coalesce operator' checks if a variable doesn't exist, but also = that it is not null, i.e. it functions like isset(). >>=20 >> Thanks. >>=20 >> --=20 >> Andrea Faulds >> http://ajf.me/ >>=20 >> --=20 >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >>=20 >=20