Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77308 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67875 invoked from network); 18 Sep 2014 11:49:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2014 11:49:22 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.176 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.176 mail-we0-f176.google.com Received: from [74.125.82.176] ([74.125.82.176:61043] helo=mail-we0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/D0-63310-FB6CA145 for ; Thu, 18 Sep 2014 07:49:21 -0400 Received: by mail-we0-f176.google.com with SMTP id q58so763618wes.35 for ; Thu, 18 Sep 2014 04:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=JiclM+1vuS6l8+h3c04UI8+ALw1wWiQeEsIJJmb9K4g=; b=xWXNFxcyMBdygHIfAP/lWuKOll4JLYSV12dsXkkbyD1PVJAbyOZG1uLT0qERfyrM/G cgI/qqaP/Jv2MFvA2r1CUbFJUdE/gIwz/K6mlrRg63Sve11aRJqwD5oZTuCJLtvyaPrP nEFKyk2HV0mRya81BNuoNHhp3BA6pPr5CKsf7Sm/aqMhL+8KJc4QquurGIsQ4oj1an2E 6GxsqNTvgMwV6XSk7kdHwvwOktsUlLvuzAHWQjdp6Kk0ftieP1i30RlJLjG5HnvcYktQ A75IYrveZyDOEHB56nwuEoz3ywnGBwsc0Zp79mmqfzxpG7d4Cfqu3V3nxYnV+wYZjZis q0WQ== X-Received: by 10.180.91.103 with SMTP id cd7mr3437427wib.67.1411040956689; Thu, 18 Sep 2014 04:49:16 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id pm6sm25697387wjb.36.2014.09.18.04.49.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 04:49:15 -0700 (PDT) Message-ID: <541AC6B8.3060702@gmail.com> Date: Thu, 18 Sep 2014 12:49:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54E82419-931D-4F9E-8115-175EA1BDC970@darkrainfall.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: rowan.collins@gmail.com (Rowan Collins) Pete Boere wrote (on 18/09/2014): > I'm seeing '??' as analogous to the way JS developers use '||', and I use > that all the time when writing JS. Actually, JS's || is more analogous to the existing ?: operator, because it checks for truthiness, not definedness (!empty() rather than isset(), in PHP terms). PHP: echo false ?: "" ?: 0 ?: "default"; JS: console.log( false || "" || 0 || "default" ); The behaviour around undefined variables is a bit different, but that's a property of JS as a language, not any suppression by the || operator (console.log(x) with undefined x is an error; console.log(x.y) with x as an empty object is not). -- Rowan Collins [IMSoP]